com.healthmarketscience.rmiio
Class GZIPRemoteInputStream
java.lang.Object
com.healthmarketscience.rmiio.RemoteStreamServer<RemoteInputStreamServer,RemoteInputStream>
com.healthmarketscience.rmiio.RemoteInputStreamServer
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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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.