Examples of InflaterInputStream


Examples of com.jcraft.jzlib.InflaterInputStream

* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public class TInflaterInputStream extends FilterInputStream {
    public TInflaterInputStream(InputStream in) throws IOException {
        super(in);
        this.in = new InflaterInputStream(in);
    }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

            }

            // create input stream
            InputStream is = dataSoc.getInputStream();
            if (factory.isZipMode()) {
                is = new InflaterInputStream(is);
            }
            return is;
        } catch (IOException ex) {
            factory.closeDataConnection();
            throw ex;
View Full Code Here

Examples of java.util.zip.InflaterInputStream

                                         
                         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;
                      
                       input_stream = new InflaterInputStream( input_stream );
                     }
                   }
                }finally{
                 
                  this_mon.exit();
View Full Code Here

Examples of java.util.zip.InflaterInputStream

        in = new GZIPInputStream( in );

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

        in = new InflaterInputStream( in );
      }
    }
   
      if ( this.state != STATE_ERROR ){
         
View Full Code Here

Examples of java.util.zip.InflaterInputStream

        if (palShades)
            smask = new byte[width * height];
        else if (genBWMask)
            smask = new byte[(width + 7) / 8 * height];
        ByteArrayInputStream bai = new ByteArrayInputStream(idat.getBuf(), 0, idat.size());
        InputStream infStream = new InflaterInputStream(bai, new Inflater());
        dataStream = new DataInputStream(infStream);
       
        if (interlaceMethod != 1) {
            decodePass(0, 0, 1, 1, width, height);
        }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

     * to try to read a corrupted stream
     * @return the decoded data
     */
    public static byte[] FlateDecode(byte in[], boolean strict) {
        ByteArrayInputStream stream = new ByteArrayInputStream(in);
        InflaterInputStream zip = new InflaterInputStream(stream);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte b[] = new byte[strict ? 4092 : 1];
        try {
            int n;
            while ((n = zip.read(b)) >= 0) {
                out.write(b, 0, n);
            }
            zip.close();
            out.close();
            return out.toByteArray();
        }
        catch (Exception e) {
            if (strict)
View Full Code Here

Examples of java.util.zip.InflaterInputStream

        IOUtils.writeString("6", def1);
        def1.close();

        byte[] b = out.toByteArray();
        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        InflaterInputStream inf1 = new InflaterInputStream(in, new Inflater(false), 8192);
        Assert.assertEquals("1", IOUtils.readString(inf1));
        Assert.assertEquals(2, IOUtils.readInt(inf1));
        Assert.assertEquals("3", IOUtils.readString(inf1));
        Assert.assertEquals("4", IOUtils.readString(inf1));
        Assert.assertEquals("5", IOUtils.readString(inf1));
        Assert.assertEquals("6", IOUtils.readString(inf1));

        Assert.assertEquals(1, inf1.available());
        Assert.assertEquals(-1, inf1.read());
        Assert.assertEquals(0, inf1.available());
    }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

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

Examples of java.util.zip.InflaterInputStream

      Header h = m.getResponseHeader("content-encoding");
      String encoding = (h == null) ? null : h.getValue();

      if (encoding != null && encoding.equals("deflate")) {
        byte[] body = m.getResponseAsBytes();
        InputStream is = new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(body)), 10000);
        return readContents(is, charset, maxKbytes);

      } else if (encoding != null && encoding.equals("gzip")) {
        byte[] body = m.getResponseAsBytes();
        InputStream is = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(body)), 10000);
View Full Code Here

Examples of java.util.zip.InflaterInputStream

      // check for deflate and gzip compression
      Header h = m.getResponseHeader("content-encoding");
      String encoding = (h == null) ? null : h.getValue();

      if (encoding != null && encoding.equals("deflate")) {
        InputStream is = new BufferedInputStream(new InflaterInputStream(m.getResponseAsStream()), 10000);
        IO.writeToFile(is, file.getPath());

      } else if (encoding != null && encoding.equals("gzip")) {
        InputStream is = new BufferedInputStream(new GZIPInputStream(m.getResponseAsStream()), 10000);
        IO.writeToFile(is, file.getPath());
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.