Changeset 10952 in josm for trunk


Ignore:
Timestamp:
2016-09-04T02:22:44+02:00 (3 years ago)
Author:
Don-vip
Message:

simplify uses of PrintWriter

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r10920 r10952  
    99import java.awt.Toolkit;
    1010import java.io.File;
    11 import java.io.FileOutputStream;
    1211import java.io.IOException;
    13 import java.io.OutputStreamWriter;
    1412import java.io.PrintWriter;
    1513import java.io.Reader;
     
    596594        }
    597595
    598         try (PrintWriter out = new PrintWriter(new OutputStreamWriter(
    599                 new FileOutputStream(prefFile + "_tmp"), StandardCharsets.UTF_8), false)) {
    600             PreferencesWriter writer = new PreferencesWriter(out, false, defaults);
     596        try (PreferencesWriter writer = new PreferencesWriter(
     597                new PrintWriter(new File(prefFile + "_tmp"), StandardCharsets.UTF_8.name()), false, defaults)) {
    601598            writer.write(settings);
    602599        }
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r10880 r10952  
    66import java.io.File;
    77import java.io.FileNotFoundException;
    8 import java.io.FileOutputStream;
    98import java.io.IOException;
    10 import java.io.OutputStreamWriter;
    119import java.io.PrintWriter;
    1210import java.nio.charset.StandardCharsets;
     
    206204
    207205    public static void saveIgnoredErrors() {
    208         try (PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(
    209                 new File(getValidatorDir(), "ignorederrors")), StandardCharsets.UTF_8), false)) {
     206        try (PrintWriter out = new PrintWriter(new File(getValidatorDir(), "ignorederrors"), StandardCharsets.UTF_8.name())) {
    210207            for (String e : ignoredErrors) {
    211208                out.println(e);
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r10616 r10952  
    88import java.io.ByteArrayInputStream;
    99import java.io.File;
    10 import java.io.FileOutputStream;
    1110import java.io.FilenameFilter;
    1211import java.io.IOException;
    1312import java.io.InputStream;
    14 import java.io.OutputStreamWriter;
    1513import java.io.PrintWriter;
    1614import java.net.MalformedURLException;
     
    236234        File cacheFile = createSiteCacheFile(pluginDir, site);
    237235        getProgressMonitor().subTask(tr("Writing plugin list to local cache ''{0}''", cacheFile.toString()));
    238         try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), StandardCharsets.UTF_8))) {
     236        try (PrintWriter writer = new PrintWriter(cacheFile, StandardCharsets.UTF_8.name())) {
    239237            writer.write(list);
    240238            writer.flush();
Note: See TracChangeset for help on using the changeset viewer.