|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.contentmanagement.baselayer.BaseLayerStream
org.gcube.contentmanagement.baselayer.inMessageImpl.InMemoryContentStream
public class InMemoryContentStream
Convenience implementation of a stream that wraps a byte array in main memory. Thus, all operations on streams can be reused and hardly any special treatment of content send in message is needed except for wrapping it with this class.
Field Summary |
---|
Fields inherited from class org.gcube.contentmanagement.baselayer.BaseLayerStream |
---|
END_OF_STREAM, NO_LIMIT, STREAM_LENGTH_IMPLICITE, URL_CONNECTION_LENGTH_UNKNOWN |
Constructor Summary | |
---|---|
InMemoryContentStream(BaseLayerStream binaryFileContent,
java.io.ByteArrayOutputStream baosToUse)
Caches content of an existing stream in memory by copying all bytes |
|
InMemoryContentStream(byte[] content)
Creates a new stream of bytes |
Method Summary | |
---|---|
static long |
copyBytes(BaseLayerStream binaryFileContent,
java.io.ByteArrayOutputStream baos)
Copies all bytes of a stream to the in memory stream, thus caches the content |
void |
dispose()
Closes the BaseLayerStream which implies that all bound resources should be freed. |
byte[] |
getContent()
Returns the content of the stream |
Methods inherited from class org.gcube.contentmanagement.baselayer.BaseLayerStream |
---|
getBufferedStream, getBufferSize, getDefaultBufferSize, getLength, getLimit, getStream, handleStartOffset, hasImpliciteLength, isBuffered, needsLimitTreatment, setBuffered, setBufferSize, setDefaultBufferSize, setLimit, setLimit, toFixedLengthStream, writeToStreamRespectingLimit |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InMemoryContentStream(byte[] content)
content
- the content of the streampublic InMemoryContentStream(BaseLayerStream binaryFileContent, java.io.ByteArrayOutputStream baosToUse) throws BaseLayerException
binaryFileContent
- the content to copybaosToUse
- a pre-initialized byte array stream for dirct access to the
content (if needed)
BaseLayerException
- if something failsMethod Detail |
---|
public byte[] getContent()
public static long copyBytes(BaseLayerStream binaryFileContent, java.io.ByteArrayOutputStream baos) throws BaseLayerException
binaryFileContent
- the content to cachebaos
- the stream to copy the bytes to
BaseLayerException
- if something goes wrongpublic void dispose() throws BaseLayerException
dispose
in class BaseLayerStream
BaseLayerException
- if something goes wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |