Ignore:
Timestamp:
2014-05-14T00:51:20+02:00 (10 years ago)
Author:
Don-vip
Message:

code refactoring/cleanup/javadoc + fix bug in preset text comparator in menu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/FileImporter.java

    r7089 r7119  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.io.BufferedInputStream;
    76import java.io.File;
    87import java.io.IOException;
    9 import java.io.InputStream;
    10 import java.nio.charset.StandardCharsets;
    118import java.util.List;
    12 import java.util.zip.GZIPInputStream;
    13 import java.util.zip.ZipEntry;
    14 import java.util.zip.ZipInputStream;
    159
    1610import javax.swing.JOptionPane;
    1711
    18 import org.apache.tools.bzip2.CBZip2InputStream;
    1912import org.openstreetmap.josm.Main;
    2013import org.openstreetmap.josm.actions.ExtensionFileFilter;
     
    138131    }
    139132
    140     public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException {
    141         if (in == null) {
    142             return null;
    143         }
    144         BufferedInputStream bis = new BufferedInputStream(in);
    145         int b = bis.read();
    146         if (b != 'B')
    147             throw new IOException(tr("Invalid bz2 file."));
    148         b = bis.read();
    149         if (b != 'Z')
    150             throw new IOException(tr("Invalid bz2 file."));
    151         return new CBZip2InputStream(bis, /* see #9537 */ true);
    152     }
    153 
    154     public static GZIPInputStream getGZipInputStream(InputStream in) throws IOException {
    155         if (in == null) {
    156             return null;
    157         }
    158         return new GZIPInputStream(in);
    159     }
    160 
    161     public static ZipInputStream getZipInputStream(InputStream in) throws IOException {
    162         if (in == null) {
    163             return null;
    164         }
    165         ZipInputStream zis = new ZipInputStream(in, StandardCharsets.UTF_8);
    166         // Positions the stream at the beginning of first entry
    167         ZipEntry ze = zis.getNextEntry();
    168         if (ze != null && Main.isDebugEnabled()) {
    169             Main.debug("Zip entry: "+ze.getName());
    170         }
    171         return zis;
    172     }
    173 
    174133    /**
    175134     * Returns the enabled state of this {@code FileImporter}. When enabled, it is listed and usable in "File->Open" dialog.
Note: See TracChangeset for help on using the changeset viewer.