Package java.util.zip

Examples of java.util.zip.GZIPInputStream


        final List<Document> docacc = new ArrayList<Document>();
        Document[] subDocs = null;
        final String ext = url.getFileExtension().toLowerCase();
        if (ext.equals("gz") || ext.equals("tgz")) {
            try {
                source = new GZIPInputStream(source);
            } catch (IOException e) {
                throw new Parser.Failure("tar parser: " + e.getMessage(), url);
            }
        }
        TarEntry entry;
View Full Code Here


       
        if (file == null || !file.exists()) return;
        BufferedReader reader = null;
        try {
            InputStream is = new FileInputStream(file);
            if (file.getName().endsWith(".gz")) is = new GZIPInputStream(is);
            reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            String line;
           
            // read lines
            String[] v;
View Full Code Here

    static final Map<String, String> HIERARCHY = new HashMap<String, String>();
    static boolean nodebug = false;

    public static void main(final String[] args) throws IOException {
        File f = new File(args[0]);
        InputStream is = new GZIPInputStream(new FileInputStream(f));
        BufferedReader lnr = new LineNumberReader(new InputStreamReader(is));
        while (true) {
            String line = lnr.readLine();
            if (line != null) {
                if (line.startsWith("class")) {
View Full Code Here

         GetMethod get = new GetMethod("http://localhost:8080/async-http-servlet-3.0-test/gzip");
         get.addRequestHeader("Accept-Encoding", "gzip, deflate");
         int status = client.executeMethod(get);
         Assert.assertEquals(200, status);
         Assert.assertEquals("gzip", get.getResponseHeader("Content-Encoding").getValue());
         GZIPInputStream gzip = new GZIPInputStream(get.getResponseBodyAsStream());
         String response = readString(gzip);


         // test that it is actually zipped
         Assert.assertEquals(response, "HELLO WORLD");
View Full Code Here

        try {
            is = new BufferedInputStream(new FileInputStream(file), 1024 * 1024);
        } catch (final OutOfMemoryError e) {
            is = new FileInputStream(file);
        }
        if (file.getName().endsWith(".gz")) is = new GZIPInputStream(is);
        final byte[] a = new byte[keylength + idxbytes];
        int c;
        Row.Entry entry;
        while (true) {
            c = is.read(a);
View Full Code Here

            bais.read();
            bais.read();
            // decompress what is remaining
            InputStream gis;
            try {
                gis = new GZIPInputStream(bais);
                final ByteArrayOutputStream baos = new ByteArrayOutputStream(b.length);
                final byte[] buf = new byte[1024 * 4];
                int n;
                while ((n = gis.read(buf)) > 0) baos.write(buf, 0, n);
                gis.close();
View Full Code Here

        if ((source.length > 1) && (((source[1] << 8) | (source[0] & 0xff)) == GZIPInputStream.GZIP_MAGIC)) {
            System.out.println("DEBUG: uncompressGZipArray - uncompressing source");
            try {
                final ByteArrayInputStream byteInput = new ByteArrayInputStream(source);
                final ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(source.length / 5);
                final GZIPInputStream zippedContent = new GZIPInputStream(byteInput);
                final byte[] data = new byte[1024];
                int read = 0;
               
                // reading gzip file and store it uncompressed
                while((read = zippedContent.read(data, 0, 1024)) != -1) {
                    byteOutput.write(data, 0, read);
                }
                zippedContent.close();
                byteOutput.close();  
               
                source = byteOutput.toByteArray();
            } catch (final Exception e) {
                if (!e.getMessage().equals("Not in GZIP format")) {
View Full Code Here

        // gis will be initialized lazy -> requires GZIP header network data
        if (gis == null) {

          bis.mark();
            try {
              gis = new GZIPInputStream(bis, COMPRESS_BUFFER_SIZE);
            } catch (BufferUnderflowException bue) {
            bis.reset();
            return;
            }
        }
View Full Code Here

        // gis will be initialized lazy -> requires GZIP header network data
        if (gis == null) {

          bis.mark();
            try {
              gis = new GZIPInputStream(bis, COMPRESS_BUFFER_SIZE);
            } catch (BufferUnderflowException bue) {
            bis.reset();
            return;
            }
        }
View Full Code Here

        return outf;
    }
   
    public static void gunzipFile(final File inFile, final File outFile) {
  try {
      final InputStream  fin  = new GZIPInputStream(new BufferedInputStream(new FileInputStream(inFile)));
      final OutputStream fout = new BufferedOutputStream(new FileOutputStream(outFile));
      copy(fout, fin, 1024);
      fin.close();
      fout.close();
  } catch (final FileNotFoundException e) {
      logger.logWarning("ERROR: file '" + inFile + "' not found", e);
  } catch (final IOException e) {
            logger.logWarning("ERROR: IO trouble ",e);
View Full Code Here

TOP

Related Classes of java.util.zip.GZIPInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.