com.healthmarketscience.rmiio
Class GZIPRemoteInputStream

java.lang.Object
  extended by com.healthmarketscience.rmiio.RemoteStreamServer<RemoteInputStreamServer,RemoteInputStream>
      extended by com.healthmarketscience.rmiio.RemoteInputStreamServer
          extended by com.healthmarketscience.rmiio.GZIPRemoteInputStream
All Implemented Interfaces:
RemoteInputStream, Closeable, Serializable, Remote, Unreferenced

public class GZIPRemoteInputStream
extends RemoteInputStreamServer

Concrete implementation of a RemoteInputStreamServer which sends compressed data in the GZIP format, which it will read from the underlying InputStream.

Author:
James Ahlborn
See Also:
Usage Notes, RemoteStreamServer.writeReplace(), Serialized Form

Field Summary
 
Fields inherited from class com.healthmarketscience.rmiio.RemoteInputStreamServer
_chunkSize, _in, DEFAULT_CHUNK_SIZE, DUMMY_MONITOR
 
Fields inherited from class com.healthmarketscience.rmiio.RemoteStreamServer
_monitor, INITIAL_INVALID_SEQUENCE_ID, INITIAL_VALID_SEQUENCE_ID, LOG
 
Constructor Summary
GZIPRemoteInputStream(InputStream in)
           
GZIPRemoteInputStream(InputStream in, RemoteStreamMonitor<RemoteInputStreamServer> monitor)
           
GZIPRemoteInputStream(InputStream in, RemoteStreamMonitor<RemoteInputStreamServer> monitor, int chunkSize)
           
 
Method Summary
protected  int availableImpl()
          Returns the number of bytes that can be read from this stream without blocking.
protected  void closeImpl(boolean readSuccess)
          Closes (possibly flushes) the underlying streams and cleans up any resources.
protected  byte[] readPacket()
          Reads the next packet of approximately RemoteInputStreamServer._chunkSize from the underlying stream and returns it.
protected  long skip(long n)
          Skips at most the given amount of bytes in the underlying stream and returns the actual number of bytes skipped.
 boolean usingGZIPCompression()
          Returns true if the stream is using GZIP compression over the wire.
 
Methods inherited from class com.healthmarketscience.rmiio.RemoteInputStreamServer
available, close, getAsSub, getInputStream, getLock, getRemoteClass, readPacket, skip
 
Methods inherited from class com.healthmarketscience.rmiio.RemoteStreamServer
abort, checkAborted, close, export, exported, finish, isClosed, unreferenced, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZIPRemoteInputStream

public GZIPRemoteInputStream(InputStream in)
                      throws IOException
Throws:
IOException

GZIPRemoteInputStream

public GZIPRemoteInputStream(InputStream in,
                             RemoteStreamMonitor<RemoteInputStreamServer> monitor)
                      throws IOException
Throws:
IOException

GZIPRemoteInputStream

public GZIPRemoteInputStream(InputStream in,
                             RemoteStreamMonitor<RemoteInputStreamServer> monitor,
                             int chunkSize)
                      throws IOException
Throws:
IOException
Method Detail

usingGZIPCompression

public boolean usingGZIPCompression()
Description copied from interface: RemoteInputStream
Returns true if the stream is using GZIP compression over the wire.

Returns:
true iff the stream data is compressed, false otherwise

availableImpl

protected int availableImpl()
                     throws IOException
Description copied from class: RemoteInputStreamServer
Returns the number of bytes that can be read from this stream without blocking.

Specified by:
availableImpl in class RemoteInputStreamServer
Returns:
the number of bytes that can be read without blocking
Throws:
IOException

closeImpl

protected void closeImpl(boolean readSuccess)
                  throws IOException
Description copied from class: RemoteStreamServer
Closes (possibly flushes) the underlying streams and cleans up any resources. Called by the finish() method.

Overrides:
closeImpl in class RemoteInputStreamServer
Parameters:
readSuccess - true iff all data was successfully transferred, false otherwise
Throws:
IOException

readPacket

protected byte[] readPacket()
                     throws IOException
Description copied from class: RemoteInputStreamServer
Reads the next packet of approximately RemoteInputStreamServer._chunkSize from the underlying stream and returns it. If this stream is using compression, this packet should contain compressed data.

Specified by:
readPacket in class RemoteInputStreamServer
Returns:
the next packet of data for this stream
Throws:
IOException

skip

protected long skip(long n)
             throws IOException
Description copied from class: RemoteInputStreamServer
Skips at most the given amount of bytes in the underlying stream and returns the actual number of bytes skipped.

Specified by:
skip in class RemoteInputStreamServer
Returns:
the actual number of bytes skipped
Throws:
IOException


Copyright © 2006–2016 Health Market Science. All rights reserved.