Package java.util.zip

Examples of java.util.zip.GZIPInputStream


                readStream = new FileInputStream(sourceFile);
                break;

            case TarFileOutputStream.Compression.GZIP_COMPRESSION :
                readStream =
                    new GZIPInputStream(new FileInputStream(sourceFile),
                                        readBuffer.length);
                break;

            default :
                throw new IllegalArgumentException(
View Full Code Here


        try {
            byte[]               data = getGZipData();
            ByteArrayInputStream bais = new ByteArrayInputStream(data);

            return new GZIPInputStream(bais);
        } catch (IOException ex) {
            throw Exceptions.transformFailed(ex);
        }
    }
View Full Code Here

                case COMPRESSION_ZIP :
                    f = new InflaterInputStream(f, new Inflater());
                    break;

                case COMPRESSION_GZIP :
                    f = new GZIPInputStream(f, b.length);
                    break;

                case COMPRESSION_NONE :
                    break;
View Full Code Here

    return Integer.parseInt(s.trim(), 16);
  }

  public static byte[] unGzip(byte[] original) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream(original.length << 2);
    GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(original), original.length);
    byte[] buffer = new byte[original.length];
    int read;
    while((read = in.read(buffer)) != -1) {
      out.write(buffer, 0, read);
    }
    return out.toByteArray();
  }
View Full Code Here

    return Integer.parseInt(s.trim(), 16);
  }

  public static byte[] unGzip(byte[] original) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream(original.length << 2);
    GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(original), original.length);
    byte[] buffer = new byte[original.length];
    int read;
    while((read = in.read(buffer)) != -1) {
      out.write(buffer, 0, read);
    }
    return out.toByteArray();
  }
View Full Code Here

*/
public class GZipFilter implements IProtocolFilter {
 
  public IRemoteMessage readObject(Object obj) {
    IRemoteMessage remoteMessage = null;
    GZIPInputStream gzis = null;
    ObjectInputStream ois = null;
   
    try {
      ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) obj);
      gzis = new GZIPInputStream(bais);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      int b;
      while ((b = gzis.read()) != -1)
        baos.write(b);
     
      gzis.close();
     
      byte[] extractedObj = baos.toByteArray();
     
      bais = new ByteArrayInputStream(extractedObj);
      ois = new ObjectInputStream(bais);
      remoteMessage = (IRemoteMessage) ois.readUnshared();
      ois.close();
    }
    catch (Exception e) {
      throw new RuntimeException("Can't read message", e); //$NON-NLS-1$
    }
    finally {
      if (gzis != null)
        try {
          gzis.close();
        } catch (IOException e) {}
     
      if (ois != null)
        try {
          ois.close();
View Full Code Here

   * @return the uncompressed content, or null if there was an error
   * @since 1.0.2
   */
  public static byte[] uncompress(final byte[] buffer){
    try{
      final GZIPInputStream gzipis = new GZIPInputStream(new ByteArrayInputStream(buffer));
     
      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
     
      final byte[] tmp = new byte[1024];
      int len;
     
      while ( (len=gzipis.read(tmp))>0 ){
        baos.write(tmp, 0, len);
      }
     
      baos.flush();
     
View Full Code Here

        InputStream d =
            database.logger.getFileAccess().openInputStreamElement(fileName);
        InputStream stream = crypto.getInputStream(d);

        stream       = new GZIPInputStream(stream);
        dataStreamIn = new BufferedReader(new InputStreamReader(stream));
        rowIn        = new RowInputTextLog();
    }
View Full Code Here

      FileOutputStream fos = new FileOutputStream(imagePath);
      fos.write(myBytes);
      fos.close();
     
      ByteArrayInputStream byteGzipIn = new ByteArrayInputStream(myBytes);
        GZIPInputStream gZipIn = new GZIPInputStream(byteGzipIn);

        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
       
        byte[] buffer = new byte[1024];
        int count = 0;
        while ((count = gZipIn.read(buffer)) > 0 ){
          bytesOut.write(buffer,0,count);
      }
      bytesOut.close();
      gZipIn.close();
     
      log.debug("gZipIn CLosed");
     
     
//      ByteArrayInputStream byteBZip2In = new ByteArrayInputStream(myBytes);
View Full Code Here

      FileOutputStream fos = new FileOutputStream(imagePath);
      fos.write(myBytes);
      fos.close();
     
      ByteArrayInputStream byteGzipIn = new ByteArrayInputStream(myBytes);
        GZIPInputStream gZipIn = new GZIPInputStream(byteGzipIn);

        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
       
        byte[] buffer = new byte[1024];
        int count = 0;
        while ((count = gZipIn.read(buffer)) > 0 ){
          bytesOut.write(buffer,0,count);
      }
      bytesOut.close();
      gZipIn.close();
     
      log.debug("gZipIn CLosed");
     
//     
//      ByteArrayInputStream byteBZip2In = new ByteArrayInputStream(myBytes);
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.