Package java.util.zip

Examples of java.util.zip.GZIPInputStream


                    
                     if ( encoding != null ){
                      
                       if ( encoding.equalsIgnoreCase( "gzip"  )){
                                         
                         error_stream = new GZIPInputStream( error_stream );
                        
                       }else if ( encoding.equalsIgnoreCase( "deflate" )){
                          
                         error_stream = new InflaterInputStream( error_stream );
                       }
                     }
                    
                    error_str = FileUtil.readInputStreamAsString( error_stream, 256 );
                  }
                 
                  throw( new ResourceDownloaderException( this, "Error on connect for '" + trimForDisplay( url ) + "': " + Integer.toString(response) + " " + http_con.getResponseMessage() + (error_str==null?"":( ": error=" + error_str ))));   
                }
                 
                getRequestProperties( con );
               
                boolean compressed = false;
               
                try{
                  this_mon.enter();
                 
                  input_stream = con.getInputStream();
                 
                  String encoding = con.getHeaderField( "content-encoding");
                  
                   if ( encoding != null ){
                    
                     if ( encoding.equalsIgnoreCase( "gzip"  )){
 
                       compressed = true;
                                         
                       input_stream = new GZIPInputStream( input_stream );
                      
                     }else if ( encoding.equalsIgnoreCase( "deflate" )){
 
                       compressed = true;
                      
View Full Code Here


        
         // System.out.println( "encoding = " + encoding );
        
         if ( gzip ){
          
           is = new GZIPInputStream( is );
         }
        
           // there are some trackers out there that don't set content length correctly
           // so we can't reliably use it :(
        
View Full Code Here

     
    if ( encoding != null ){

      if ( encoding.equalsIgnoreCase( "gzip" )){

        in = new GZIPInputStream( in );

      }else if ( encoding.equalsIgnoreCase( "deflate" )){

        in = new InflaterInputStream( in );
      }
View Full Code Here

        Header contentEncoding =
                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
        if (contentEncoding != null) {
            if (contentEncoding.getValue().
                    equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
                in = new GZIPInputStream(in);
                // If the content-encoding is identity we can basically ignore it.
            } else if (!"identity".equalsIgnoreCase(contentEncoding.getValue())) {
                throw new AxisFault("HTTP :" + "unsupported content-encoding of '"
                        + contentEncoding.getValue() + "' found");
            }
View Full Code Here

  protected void extractGZip(String in, String out) throws Exception {

    File f = new File(in);
    FileInputStream fileInputHandle = new FileInputStream(f);

    InputStream inputHandle = new GZIPInputStream(fileInputHandle);

    OutputStream outputHandle;
    outputHandle = new FileOutputStream(out);

    byte [] buffer = new byte [1<<14];

    int ret = inputHandle.read(buffer);
    while (ret >= 1) {
      outputHandle.write(buffer,0,ret);
      ret = inputHandle.read(buffer);
    }

    inputHandle.close();
    outputHandle.close();

    outputHandle = null;
    inputHandle = null;
View Full Code Here

    return new TRECDocumentCollection( file, factory.copy(), descriptors, bufferSize, useGzip );
  }

  private final InputStream openFileStream( String fileName ) throws IOException {
    final InputStream s = new FileInputStream( fileName );
    if ( useGzip ) return new GZIPInputStream( s );
    else return s;
  }
View Full Code Here

    pl.start( "Scanning files..." );
   
    // Scan files and retrieve page pointers
    for( String f : file ) {
      p.clear();
      final FastBufferedInputStream fbis = gzipped ? new FastBufferedInputStream( new GZIPInputStream( new FileInputStream( f ) ) ) : new FastBufferedInputStream( new FileInputStream( f ) );
      long position;
      for(;;) {
        position = fbis.position();
        if ( readLine( fbis ) == -1 ) break;
        if ( startsWith( lineBuffer, DOC_MARKER ) ) p.add( position );
View Full Code Here

       
        if ( content_encoding != null ){

          if ( content_encoding.equalsIgnoreCase( "gzip"  )){
              
            target_is = new GZIPInputStream( target_is );
                           
           }else if ( content_encoding.equalsIgnoreCase( "deflate" )){
              
             target_is = new InflaterInputStream( target_is );
           }
View Full Code Here

     
      System.arraycopy( data, 1, to_decode, 0, data.length - 1 );
     
    }else{
     
      GZIPInputStream is = new GZIPInputStream(new ByteArrayInputStream( data, 1, data.length - 1 ));
     
      to_decode = FileUtil.readInputStreamAsByteArray( is );
     
      is.close();
    }
   
    Map res = BDecoder.decode( to_decode );
   
      // remove any injected random seed
View Full Code Here

  }

  public static void gunzip(File src, File dst) throws IOException {
    final byte[] b = new byte[(int) Size.OneMeg.bytes()];

    final GZIPInputStream in = new GZIPInputStream(new FileInputStream(src));

    final OutputStream out = new FileOutputStream(dst);

    int length = 0;
    while ((length = in.read(b)) != -1) {
      out.write(b, 0, length);
    }

    in.close();
    out.close();

  }
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.