jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
changeset 13041 8477cb6992be
parent 9461 4fd9dcb3a5d0
child 22567 5816a47fa4dd
equal deleted inserted replaced
13040:1f31b09f711d 13041:8477cb6992be
     1 /*
     1 /*
     2  * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    31 import java.io.FileOutputStream;
    31 import java.io.FileOutputStream;
    32 import java.io.IOException;
    32 import java.io.IOException;
    33 import java.net.InetAddress;
    33 import java.net.InetAddress;
    34 import java.net.UnknownHostException;
    34 import java.net.UnknownHostException;
    35 import java.nio.charset.Charset;
    35 import java.nio.charset.Charset;
       
    36 import java.nio.file.Files;
    36 import java.util.HashMap;
    37 import java.util.HashMap;
    37 import java.util.HashSet;
    38 import java.util.HashSet;
    38 import java.util.Properties;
    39 import java.util.Properties;
    39 import java.util.Scanner;
    40 import java.util.Scanner;
    40 import sun.awt.FontConfiguration;
    41 import sun.awt.FontConfiguration;
   385              * directory no client will ever see a partially written file.
   386              * directory no client will ever see a partially written file.
   386              */
   387              */
   387             File fcInfoFile = getFcInfoFile();
   388             File fcInfoFile = getFcInfoFile();
   388             File dir = fcInfoFile.getParentFile();
   389             File dir = fcInfoFile.getParentFile();
   389             dir.mkdirs();
   390             dir.mkdirs();
   390             File tempFile = File.createTempFile("fcinfo", null, dir);
   391             File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
   391             FileOutputStream fos = new FileOutputStream(tempFile);
   392             FileOutputStream fos = new FileOutputStream(tempFile);
   392             props.store(fos,
   393             props.store(fos,
   393                       "JDK Font Configuration Generated File: *Do Not Edit*");
   394                       "JDK Font Configuration Generated File: *Do Not Edit*");
   394             fos.close();
   395             fos.close();
   395             boolean renamed = tempFile.renameTo(fcInfoFile);
   396             boolean renamed = tempFile.renameTo(fcInfoFile);