org.cloudfoundry.client.lib.io
Class DynamicZipInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.cloudfoundry.client.lib.io.DynamicInputStream
          extended by org.cloudfoundry.client.lib.io.DynamicZipInputStream
All Implemented Interfaces:
Closeable

public class DynamicZipInputStream
extends DynamicInputStream

InputStream that dynamically creates ZIP contents as the stream is read without consuming too much memory. Zip entries should be provided on construction.

Author:
Phillip Webb

Nested Class Summary
static interface DynamicZipInputStream.Entry
          Represents a single entry from a ZIP files.
 
Constructor Summary
DynamicZipInputStream(Iterable<DynamicZipInputStream.Entry> entries)
          Create a new DynamicZipInputStream instance.
 
Method Summary
 void close()
           
protected  boolean writeMoreData()
          Called when more data should be written to the output stream.
 
Methods inherited from class org.cloudfoundry.client.lib.io.DynamicInputStream
getOutputStream, read, read
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicZipInputStream

public DynamicZipInputStream(Iterable<DynamicZipInputStream.Entry> entries)
Create a new DynamicZipInputStream instance.

Parameters:
entries - the zip entries that should be written to the stream
Method Detail

writeMoreData

protected boolean writeMoreData()
                         throws IOException
Description copied from class: DynamicInputStream
Called when more data should be written to the output stream. This method can be called many times, implementations should write zero or more bytes to output stream on each call. Generally it is recommended that not more that 4096 bytes are written in a single call.

Specified by:
writeMoreData in class DynamicInputStream
Returns:
false when no more data is available to write.
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException


Copyright © 2013. All rights reserved.