Examples of InflaterInputStream


Examples of java.util.zip.InflaterInputStream

            byte[] decodedMessage = Base64.decode(samlMessage);
            is = new ByteArrayInputStream(decodedMessage);
        } else {
            byte[] base64Decoded = Base64.decode(samlMessage);
            ByteArrayInputStream bais = new ByteArrayInputStream(base64Decoded);
            is = new InflaterInputStream(bais, new Inflater(true));
        }

        Document document = getDocument(is);
        String issuerEntityId;
        RequestAbstractType samlRequestMessage = null;
View Full Code Here

Examples of java.util.zip.InflaterInputStream

            LOGGER.info("URL connection input stream is compressed using gzip");
            is = new BufferedInputStream(new GZIPInputStream(
                    conn.getInputStream()));
        } else if ("deflate".equals(contentEncoding)) {
            LOGGER.info("URL connection input stream is compressed using deflate");
            is = OWLOntologyDocumentSourceBase.wrap(new InflaterInputStream(
                    conn.getInputStream(), new Inflater(true)));
        } else {
            is = OWLOntologyDocumentSourceBase.wrap(conn.getInputStream());
        }
        return is;
View Full Code Here

Examples of java.util.zip.InflaterInputStream

   
    try
   
     
      if(useCompress)
        breader = new BufferedReader(new InputStreamReader(new InflaterInputStream(new FileInputStream(file)), "GBK"));
      else
        breader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));
     
      String line;
      boolean isFirstLine = true;
View Full Code Here

Examples of java.util.zip.InflaterInputStream

    public TryInflaterInputStream(InputStream in) throws IOException {
        BufferedInputStream bufferedIn = new BufferedInputStream(in, TEST_COMPRESSED_SIZE);
        bufferedIn.mark(TEST_COMPRESSED_SIZE);
        try {
            InflaterInputStream testCompressedIn = new InflaterInputStream(bufferedIn);
            byte[] temp = new byte[TEST_COMPRESSED_SIZE / 10];
            testCompressedIn.read(temp);

            this.in = new InflaterInputStream(bufferedIn);
        } catch (Exception ex) {
            this.in = bufferedIn;
        } finally {
            bufferedIn.reset();
        }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

    /**
     * {@inheritDoc}
     */
    @Override
    public byte[] inflate(ByteArrayOutputStream imageBytes) throws IOException {
        InflaterInputStream inflater = new InflaterInputStream(new ByteArrayInputStream(imageBytes.toByteArray()));
        ByteArrayOutputStream inflatedOut = new ByteArrayOutputStream();

        int readLength;
        byte[] block = new byte[8192];
        while ((readLength = inflater.read(block)) != -1) {
            inflatedOut.write(block, 0, readLength);
        }

        return inflatedOut.toByteArray();
    }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

    public static byte[] processDeflateEncoded(byte[] compressed, int sizeLimit) throws IOException {
        ByteArrayOutputStream outStream = new ByteArrayOutputStream(EXPECTED_DEFLATE_COMPRESSION_RATIO * compressed.length);

        // "true" because HTTP does not provide zlib headers
        Inflater inflater = new Inflater(true);
        InflaterInputStream inStream = new InflaterInputStream(new ByteArrayInputStream(compressed), inflater);

        byte[] buf = new byte[BUF_SIZE];
        int written = 0;
        while (true) {
            try {
                int size = inStream.read(buf);
                if (size <= 0) {
                    break;
                }
               
                if ((written + size) > sizeLimit) {
View Full Code Here

Examples of java.util.zip.InflaterInputStream

            case ZipEntry.STORED:
                return bis;
            case ZipEntry.DEFLATED:
                bis.addDummy();
                final Inflater inflater = new Inflater(true);
                return new InflaterInputStream(bis, inflater) {
                    @Override
                    public void close() throws IOException {
                        super.close();
                        inflater.end();
                    }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

            case ZipEntry.STORED:
                return bis;
            case ZipEntry.DEFLATED:
                bis.addDummy();
                final Inflater inflater = new Inflater(true);
                return new InflaterInputStream(bis, inflater) {
                    @Override
                    public void close() throws IOException {
                        super.close();
                        inflater.end();
                    }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

    return new DeflaterInputStream(in);
  }

  @Override
  public InputStream uncompress(InputStream in) {
    return new InflaterInputStream(in);
  }
View Full Code Here

Examples of java.util.zip.InflaterInputStream

            //log.debug( "wrapping response in GZIPInputStream" );
            respBody = new GZIPInputStream( respBody );
          }
          else if( contentEncoding.contains( "deflate" ) ) {
            //log.debug( "wrapping response in InflaterInputStream" );
            respBody = new InflaterInputStream(respBody);
          }
        }
        else {
          Header contentTypeHeader = method.getResponseHeader( "Content-Type" );
          if( contentTypeHeader != null ) {
            String contentType = contentTypeHeader.getValue();
            if( contentType != null ) {
              if( contentType.startsWith( "application/x-gzip-compressed" ) ) {
                //log.debug( "wrapping response in GZIPInputStream" );
                respBody = new GZIPInputStream( respBody );
              }
              else if ( contentType.startsWith("application/x-deflate") ) {
                //log.debug( "wrapping response in InflaterInputStream" );
                respBody = new InflaterInputStream(respBody);
              }
            }
          }
        }
      }
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.