public final class StreamManager extends Object
InputByteStream and OutputByteStream instances.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this
StreamManager. |
void |
close(boolean ignoreMaster)
Close this
StreamManager. |
ByteWriter |
getByteWriter(ByteWriterFactory.Fixed fixed,
long size)
Create a
ByteWriter. |
InputByteStream |
getInputByteStream(byte[] b)
Only for internal engineering use.
|
InputByteStream |
getInputByteStream(ByteReader byteReader)
Only for internal engineering use.
|
InputByteStream |
getInputByteStream(ByteReader byteReader,
long startOffset,
long length)
Only for internal engineering use.
|
InputByteStream |
getInputByteStream(InputByteStream[] byteStreams)
Only for internal engineering use.
|
OutputByteStream |
getOutputByteStream(ByteWriter byteWriter)
Only for internal engineering use.
|
OutputByteStream |
getOutputByteStream(ByteWriterFactory.Longevity longevity,
ByteWriterFactory.EncryptionStatus encryption,
ByteWriterFactory.Fixed fixed,
long size,
boolean fast)
Create an
OutputByteStream for use within the PDF toolkit. |
OutputByteStream |
getOutputByteStreamClearDocument(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.LONG EncryptionStatus - EncryptionStatus.CLEAR This is intended to create an OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is not encrypted nor is it decrypted. |
OutputByteStream |
getOutputByteStreamClearTemp(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.TEMPORARY EncryptionStatus - EncryptionStatus.CLEAR This is intended to create an OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is not encrypted nor is
it decrypted. |
OutputByteStream |
getOutputByteStreamDecryptedDocument(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.LONG EncryptionStatus - EncryptionStatus.DECRYPTED This is intended to create an OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is decrypted. |
OutputByteStream |
getOutputByteStreamDecryptedTemp(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.TEMPORARY EncryptionStatus - EncryptionStatus.DECRYPTED This is intended to create an OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is decrypted. |
OutputByteStream |
getOutputByteStreamEncryptedDocument(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.LONG EncryptionStatus - EncryptionStatus.ENCRYPTED This is intended to create an OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is encrypted. |
OutputByteStream |
getOutputByteStreamEncryptedTemp(ByteWriterFactory.Fixed fixed,
long size)
A utility function that calls
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
Longevity - Longevity.TEMPORARY EncryptionStatus - EncryptionStatus.ENCRYPTED This is intended to create an OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is encrypted. |
OutputByteStream |
getUnregisteredOutputByteStream(ByteWriter byteWriter)
Only for internal engineering use.
|
OutputByteStream |
getUnregisteredOutputByteStream(ByteWriterFactory.Fixed fixed,
int size)
Create an
OutputByteStream for use within the COS layer of the PDF toolkit. |
static StreamManager |
newInstance(ByteWriterFactory byteWriterFactory,
ByteReader masterByteReader)
Creates a new instance of the
StreamManager. |
void |
resetMasterByteReader(ByteReader masterByteReader)
Reset the master
ByteReader and close it and all InputByteStream
instances made from it. |
public static StreamManager newInstance(ByteWriterFactory byteWriterFactory, ByteReader masterByteReader)
StreamManager.
The ByteWriterFactory is used as the source of all new data sinks that are
created.
The "master" ByteReader is the main ByteReader used in the
document processing. It is the backing store for the document. This will be closed and so
will all InputByteStream instances made from it when the StreamManager
is closed or the master ByteReader is reset.byteWriterFactory - factory to use for creating new OutputByteStream instancesmasterByteReader - the "master" byte reader, can be null if there is no masterStreamManagerpublic void resetMasterByteReader(ByteReader masterByteReader) throws IOException
ByteReader and close it and all InputByteStream
instances made from it.masterByteReader - the new master ByteReader, can be nullIOExceptionpublic InputByteStream getInputByteStream(ByteReader byteReader) throws IOException
InputByteStream from a ByteReader.byteReader - A ByteReader to be used for creating the InputByteStream.InputByteStream.IOExceptionpublic InputByteStream getInputByteStream(ByteReader byteReader, long startOffset, long length) throws IOException
InputByteStream from a ByteReader.byteReader - A ByteReader to be used for creating the InputByteStream.InputByteStream.IOExceptionpublic InputByteStream getInputByteStream(byte[] b) throws IOException
InputByteStream from a byte array.b - An array of bytes to be used for creating the InputByteStream.InputByteStream.IOExceptionpublic InputByteStream getInputByteStream(InputByteStream[] byteStreams) throws IOException
OutputByteStream.
This creates an OutputByteStream that wraps multiple OutputByteStream
objects and makes them appear as one large OutputByteStream. The OutputByteStream
objects that are passed must not be modified in any way until the wrapping
OutputByteStream returned from this method is no longer in use.byteStreams - An array of OutputByteStream objects.OutputByteStream.IOExceptionpublic OutputByteStream getOutputByteStream(ByteWriter byteWriter) throws IOException
OutputByteStream from a ByteWriter.byteWriter - A ByteWriter to be used for creating the OutputByteStream.OutputByteStream.IOExceptionpublic OutputByteStream getUnregisteredOutputByteStream(ByteWriter byteWriter) throws IOException
OutputByteStream from a ByteWriter. The
returned OutputByteStream is unregistered and so will not be managed
by the stream manager. It is the responsibility of the caller to ensure that the
ByteWriter and the OutputByteStream are properly closed.byteWriter - A ByteWriter to be used for creating the OutputByteStream.OutputByteStream.IOExceptionpublic OutputByteStream getOutputByteStreamClearTemp(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is not encrypted nor is
it decrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getOutputByteStreamEncryptedTemp(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is encrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getOutputByteStreamDecryptedTemp(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose duration is temporary
(lasting the duration of a single method) and the data to be stored is decrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getOutputByteStreamClearDocument(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is not encrypted nor is it decrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getOutputByteStreamEncryptedDocument(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is encrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getOutputByteStreamDecryptedDocument(ByteWriterFactory.Fixed fixed, long size) throws IOException
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
with the following parameters:
OutputByteStream whose expected duration
of existence is of similar length to that of the PDFDocument and the
data to be stored is decrypted.fixed - whether the memory size is fixed or growablesize - the number of bytes for OutputByteStreamOutputByteStreamIOExceptionpublic OutputByteStream getUnregisteredOutputByteStream(ByteWriterFactory.Fixed fixed, int size) throws IOException
OutputByteStream for use within the COS layer of the PDF toolkit.
This OutputByteStream will not be kept track of through an internal registry
and if not used correctly and carefully can lead to problems. This is not to be used
outside of the COS layer.
If it is desired to turn the
OutputByteStream into an InputByteStream this can be done
by using the OutputByteStream.closeAndConvert() method.fixed - is the OutputByteStream of a fixed size or notsize - the actual size of a fixed OutputByteStream or an estimate of a growable oneIOExceptionpublic OutputByteStream getOutputByteStream(ByteWriterFactory.Longevity longevity, ByteWriterFactory.EncryptionStatus encryption, ByteWriterFactory.Fixed fixed, long size, boolean fast) throws IOException
OutputByteStream for use within the PDF toolkit. This OutputByteStream
will be kept track of through an internal registry and will need to be properly closed by the caller. If
it is desired to turn the OutputByteStream into an InputByteStream this can be done
by using the OutputByteStream.closeAndConvert() method.longevity - an estimate of how long the OutputByteStream will remain in useencryption - the encryption status of the contents of the OutputByteStreamfixed - is the OutputByteStream of a fixed size or notsize - the actual size of a fixed OutputByteStream or an estimate of a growable onefast - a request for a faster OutputByteStream which is only a suggestionIOExceptionpublic ByteWriter getByteWriter(ByteWriterFactory.Fixed fixed, long size) throws IOException
ByteWriter. This ByteWriter is not kept track of and
will need to be properly closed by the caller. This is a potentially large resource leak if used
improperly. Be extremely careful. This method is only in place for one place within
the code that will soon be rewritten. Do not use for new code.
This method has similar parameters as
#getOutputByteStream(Longevity, EncryptionStatus, Fixed, long, boolean)
but makes the following default choices:
Longevity - Longevity.LONG
EncryptionStatus - EncryptionStatus.CLEAR
fixed - is the OutputByteStream of a fixed size or notsize - the actual size of a fixed OutputByteStream or an estimate of a growable oneIOExceptionpublic void close()
throws IOException
StreamManager. This closes all open ByteReader instances and
any InputByteStream instances made from. The ByteWriterFactory given
during construction is also closed.
In the future if there are open ByteReader instances this will be considered
an error state and an exception will be thrown.IOExceptionpublic void close(boolean ignoreMaster)
throws IOException
StreamManager. This closes all open ByteReader instances and
any InputByteStream instances made from. The ByteWriterFactory given
during construction is also closed.
In the future if there are open ByteReader instances this will be considered
an error state and an exception will be thrown.ignoreMaster - if true the master ByteReader is ignored for closing and
it will be the responsibility of the caller to close itIOExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved