Examples of CBZip2InputStream


Examples of at.molindo.thirdparty.org.apache.tools.bzip2.CBZip2InputStream

        // stream
        in.reset();
      }
    }

    in = new CBZip2InputStream(in);
    return in;
  }
View Full Code Here

Examples of org.apache.commons.compress.bzip2.CBZip2InputStream

  public static final String VERSION = "$Header$";

  protected void process(String exepath, String[] args) throws Exception {
    BufferObjectWriter out = new BufferObjectWriter(getStdOut());
    BufferInputStream in = getStdInStream();
    CBZip2InputStream bin = new CBZip2InputStream(in);
    ObjectInputStream oin = new ObjectInputStream(bin);
    Object obj;
    try {
      boolean eof = false;
      while( !eof ) {
        try {
          obj = oin.readObject();
          out.writeObject(obj);
        } catch (java.io.OptionalDataException ode) {
          if(ode.eof) {
            eof = true;
            oin.close();
            bin.close();
            in.close();
          } else {
            throw ode;
          }
        }
View Full Code Here

Examples of org.apache.hadoop.io.compress.bzip2.CBZip2InputStream

    public BZip2CompressionInputStream(InputStream in) throws IOException {

      super(in);
      BufferedInputStream bufferedIn = readStreamHeader();
      input = new CBZip2InputStream(bufferedIn);
    }
View Full Code Here

Examples of org.apache.hadoop.io.compress.bzip2.CBZip2InputStream

    private void internalReset() throws IOException {
      if (needsReset) {
        needsReset = false;
        BufferedInputStream bufferedIn = readStreamHeader();
        input = new CBZip2InputStream(bufferedIn);
      }
    }   
View Full Code Here

Examples of org.apache.hadoop.io.compress.bzip2.CBZip2InputStream

      this.readMode = readMode;
      if (this.startingPos == 0) {
        // We only strip header if it is start of file
        bufferedIn = readStreamHeader();
      }
      input = new CBZip2InputStream(bufferedIn, readMode);
      if (this.isHeaderStripped) {
        input.updateReportedByteCount(HEADER_LEN);
      }

      if (this.isSubHeaderStripped) {
View Full Code Here

Examples of org.apache.tika.parser.pkg.bzip2.CBZip2InputStream

        xhtml.startDocument();

        // At the end we want to close the bzip2 stream to release any associated
        // resources, but the underlying document stream should not be closed
        InputStream gzip =
            new CBZip2InputStream(new CloseShieldInputStream(stream));
        try {
            Metadata entrydata = new Metadata();
            String name = metadata.get(Metadata.RESOURCE_NAME_KEY);
            if (name != null) {
                if (name.endsWith(".tbz")) {
                    name = name.substring(0, name.length() - 4) + ".tar";
                } else if (name.endsWith(".tbz2")) {
                    name = name.substring(0, name.length() - 5) + ".tar";
                } else if (name.endsWith(".bz")) {
                    name = name.substring(0, name.length() - 3);
                } else if (name.endsWith(".bz2")) {
                    name = name.substring(0, name.length() - 4);
                }
                entrydata.set(Metadata.RESOURCE_NAME_KEY, name);
            }
            parseEntry(gzip, xhtml, entrydata);
        } finally {
            gzip.close();
        }

        xhtml.endDocument();
    }
View Full Code Here

Examples of org.apache.tools.bzip2.CBZip2InputStream

        final int b2 = is.read();
        if (b1 != 'B' || b2 != 'Z')
        {
            throw new FileSystemException("vfs.provider.compressedFile/not-a-compressedFile-file.error", name);
        }
        return new CBZip2InputStream(is);
    }
View Full Code Here

Examples of org.apache.tools.bzip2.CBZip2InputStream

            if (sourcefile.getName().endsWith(".bz2")) {
                int b = is.read();
                if (b != 'B') throw new IOException("Invalid bz2 content.");
                b = is.read();
                if (b != 'Z') throw new IOException("Invalid bz2 content.");
                is = new CBZip2InputStream(is);
            } else if (sourcefile.getName().endsWith(".gz")) {
                is = new GZIPInputStream(is);
            }
            BufferedReader r = new BufferedReader(new java.io.InputStreamReader(is, "UTF-8"), 4 * 1024 * 1024);
            String t;
View Full Code Here

Examples of org.apache.tools.bzip2.CBZip2InputStream

                throw new Exception("Invalid bz2 content.");
            }          
           
            int read = 0;
            final byte[] data = new byte[1024];
            final CBZip2InputStream zippedContent = new CBZip2InputStream(source);       
           
            tempFile = File.createTempFile("bunzip","tmp");
            tempFile.deleteOnExit();
           
            // creating a temp file to store the uncompressed data
            final FileOutputStream out = new FileOutputStream(tempFile);
           
            // reading gzip file and store it uncompressed
            while((read = zippedContent.read(data, 0, 1024)) != -1) {
                out.write(data, 0, read);
            }
            zippedContent.close();
            out.close();
           
            // creating a new parser class to parse the unzipped content
            docs = TextParser.parseSource(location, null, null, tempFile);
        } catch (final Exception e) { 
View Full Code Here

Examples of org.apache.tools.bzip2.CBZip2InputStream

          for (int i = 0; i < magic.length; i++) {
            if (istream.read() != magic[i]) {
              throw new BuildException("Invalid bz2 file." + file.toString());
            }
          }
          return new CBZip2InputStream(istream);
        }
      }
      return istream;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.