Package java.util.zip

Examples of java.util.zip.InflaterInputStream


            try {
                ByteSequence bodyAsBytes = getContent();
                if (bodyAsBytes != null) {
                    is = new ByteArrayInputStream(bodyAsBytes);
                    if (isCompressed()) {
                        is = new InflaterInputStream(is);
                    }
                    DataInputStream dataIn = new DataInputStream(is);
                    text = MarshallingSupport.readUTF8(dataIn);
                    dataIn.close();
                    setContent(null);
View Full Code Here


      switch(ContentEncoding.valueOf(encodings[n].toUpperCase().replaceAll("-", ""))) {
        case GZIP:
        case XGZIP:
          in = new GZIPInputStream(in); break;
        case DEFLATE:
          in = new InflaterInputStream(in); break;
      }
    }
    return in;
  }
View Full Code Here

        }
    }

    public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
        InputStream is = exchange.getIn().getMandatoryBody(InputStream.class);
        InflaterInputStream unzipInput = new InflaterInputStream(is);
       
        // Create an expandable byte array to hold the inflated data
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            IOHelper.copy(unzipInput, bos);
View Full Code Here

            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

    outputChunked.endChunks();
  }

  public Object read (Kryo kryo, Input input, Class type) {
    // The inflater would read from input beyond the compressed bytes if chunked enoding wasn't used.
    InflaterInputStream inflaterStream = new InflaterInputStream(new InputChunked(input, 256), new Inflater(noHeaders));
    return kryo.readObject(new Input(inflaterStream, 256), type, serializer);
  }
View Full Code Here

    throw new ContentCreationException("This repository is read-only");
  }

  public InputStream getInputStream() throws ContentIOException, IOException
  {
    return new InflaterInputStream(new ByteArrayInputStream(rawData));
  }
View Full Code Here

    deflater.finish();
    deflater.end();

    final byte[] data = outputStream.toByteArray();
    final ByteArrayInputStream bin = new ByteArrayInputStream(data);
    final InflaterInputStream infi = new InflaterInputStream(bin);

    final ZipRepository repository = (ZipRepository) item.getRepository();

    final String contentId = (String) item.getContentId();
    final ZipEntry zipEntry = new ZipEntry(contentId);

    final Object comment = item.getAttribute(LibRepositoryBoot.ZIP_DOMAIN, LibRepositoryBoot.ZIP_COMMENT_ATTRIBUTE);
    if (comment != null)
    {
      zipEntry.setComment(String.valueOf(comment));
    }
    final Object version = item.getAttribute(LibRepositoryBoot.REPOSITORY_DOMAIN, LibRepositoryBoot.VERSION_ATTRIBUTE);
    if (version instanceof Date)
    {
      final Date date = (Date) version;
      zipEntry.setTime(date.getTime());
    }

    final int zipMethod = RepositoryUtilities.getZipMethod(item);
    zipEntry.setCrc(crc32.getValue());
    if (zipMethod == Deflater.NO_COMPRESSION)
    {
      zipEntry.setCompressedSize(size);
      zipEntry.setSize(size);
    }
    else
    {
      zipEntry.setSize(size);
    }
    repository.writeContent(zipEntry, infi, zipMethod, RepositoryUtilities.getZipLevel(item));
    infi.close();

    closed = true;
    outputStream = null;
    deflaterOutputStream = null;
  }
View Full Code Here

    return new ZipEntryOutputStream(this);
  }

  public InputStream getInputStream() throws ContentIOException, IOException
  {
    return new InflaterInputStream(new ByteArrayInputStream(rawData));
  }
View Full Code Here

        try {
            if (getContent() != null && map.isEmpty()) {
                ByteSequence content = getContent();
                InputStream is = new ByteArrayInputStream(content);
                if (isCompressed()) {
                    is = new InflaterInputStream(is);
                }
                DataInputStream dataIn = new DataInputStream(is);
                map = MarshallingSupport.unmarshalPrimitiveMap(dataIn);
                dataIn.close();
            }
View Full Code Here

            try {
                ByteSequence bodyAsBytes = getContent();
                if (bodyAsBytes != null) {
                    is = new ByteArrayInputStream(bodyAsBytes);
                    if (isCompressed()) {
                        is = new InflaterInputStream(is);
                    }
                    DataInputStream dataIn = new DataInputStream(is);
                    text = MarshallingSupport.readUTF8(dataIn);
                    dataIn.close();
                    setContent(null);
View Full Code Here

TOP

Related Classes of java.util.zip.InflaterInputStream

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.