The information in the description is only guaranteed to be valid at the moment it is passed to the decoder object. As the decoder works on the stream, the information in the descriptor will be outdated.
To create a stream descriptor, obtain a Builder instance and set the
required parameters.
Builder
| Modifier and Type | Class and Description |
|---|---|
| public static class | CharacterStreamDescriptor.
The builder for the |
| Modifier and Type | Field and Description |
|---|---|
| public static final long | BEFORE_FIRST
Constant for the character position, when it is positioned before the first character in the stream (i.e. at the very beginning of the stream or in the header). |
| private final boolean | bufferable
Tells if the stream can be buffered or not. |
| private final long | byteLength
The byte length of the stream, |
| private final long | charLength
The character length of the stream, |
| private final long | curBytePos
The current byte position. |
| private final long | curCharPos
The current character position. |
| private final long | dataOffset
First data byte in the byte stream. |
| private final long | maxCharLength
The maximum allowed character length. |
| private final boolean | positionAware
Tells if the stream is aware of its own position. |
| private final InputStream | stream
Reference to the stream we are describing. |
| Access | Constructor and Description |
|---|---|
| private | CharacterStreamDescriptor(CharacterStreamDescriptor.
object builder bCreates a character stream descriptor, using the supplied builder. |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public long | |
| public long | |
| public long | Returns: The current character position, where the first character is at position1, or BEFORE_FIRST if the stream is
positioned before the first character.Returns the current character position. |
| public long | Returns: The first position in the stream containing real data.Returns the first index of the described stream that contains real data. |
| public long | Returns: The max allowed character length of the stream, or0 if
no limit has been set.Returns the imposed maximum character length on the described stream. |
| public PositionedStream | Returns: APositionedStream reference.Returns the associated positioned stream, if the stream is position aware. |
| public InputStream | |
| public boolean | Returns: true if the stream should be buffered for improved
performance, false if it should not be buffered.Tells if the described stream should be buffered or not. |
| public boolean | Returns: true if the stream is position aware, @{code false}
otherwise.Tells if the described stream is aware of its own position, and that it can reposition itself on request. |
| public String |
| BEFORE_FIRST | back to summary |
|---|---|
| public static final long BEFORE_FIRST Constant for the character position, when it is positioned before the first character in the stream (i.e. at the very beginning of the stream or in the header). | |
| bufferable | back to summary |
|---|---|
| private final boolean bufferable Tells if the stream can be buffered or not. | |
| byteLength | back to summary |
|---|---|
| private final long byteLength The byte length of the stream, | |
| charLength | back to summary |
|---|---|
| private final long charLength The character length of the stream, | |
| curBytePos | back to summary |
|---|---|
| private final long curBytePos The current byte position. | |
| curCharPos | back to summary |
|---|---|
| private final long curCharPos The current character position. | |
| dataOffset | back to summary |
|---|---|
| private final long dataOffset First data byte in the byte stream. | |
| maxCharLength | back to summary |
|---|---|
| private final long maxCharLength The maximum allowed character length. | |
| positionAware | back to summary |
|---|---|
| private final boolean positionAware Tells if the stream is aware of its own position. | |
| stream | back to summary |
|---|---|
| private final InputStream stream Reference to the stream we are describing. | |
| CharacterStreamDescriptor | back to summary |
|---|---|
| private CharacterStreamDescriptor(CharacterStreamDescriptor. Creates a character stream descriptor, using the supplied builder. Use the builder to create instances of this class.
| |
| getByteLength | back to summary |
|---|---|
| public long getByteLength() | |
| getCharLength | back to summary |
|---|---|
| public long getCharLength() | |
| getCurBytePos | back to summary |
|---|---|
| public long getCurBytePos() | |
| getCurCharPos | back to summary |
|---|---|
| public long getCurCharPos() Returns the current character position.
| |
| getDataOffset | back to summary |
|---|---|
| public long getDataOffset() Returns the first index of the described stream that contains real data. The information is typically used to filter out meta data at the head of the stream, and to correctly reset the stream.
| |
| getMaxCharLength | back to summary |
|---|---|
| public long getMaxCharLength() Returns the imposed maximum character length on the described stream.
The default value is
| |
| getPositionedStream | back to summary |
|---|---|
| public PositionedStream getPositionedStream() Returns the associated positioned stream, if the stream is position aware.
| |
| getStream | back to summary |
|---|---|
| public InputStream getStream() Returns the associated stream.
| |
| isBufferable | back to summary |
|---|---|
| public boolean isBufferable() Tells if the described stream should be buffered or not. Some of the reasons a stream should not be buffered at this level, are the stream is already buffered, or it serves bytes directly from a byte array in memory.
| |
| isPositionAware | back to summary |
|---|---|
| public boolean isPositionAware() Tells if the described stream is aware of its own position, and that it can reposition itself on request.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
CharacterStreamDescriptor class. The builder
is used to avoid having a large set of constructors. See the
build method for pre-build field validation. Note that the
validation is only performed in sane builds.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private long | |
| private long | |
| private long | |
| private long | |
| private long | |
| private static final long | DEFAULT_MAX_CHAR_LENGTH
Default max character length is unlimited. |
| private long | |
| private boolean | |
| private InputStream |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CharacterStreamDescriptor. | Returns: The builder.true if buffering is advised, false
if notSets if the stream should be buffered, defaults to |
| public CharacterStreamDescriptor | Returns: A character stream descriptor instance.Creates a descriptor object based on the parameters kept in the builder instance. |
| public CharacterStreamDescriptor. | Returns: The builder.the byte length of the stream (including header) length)Sets the byte length of the stream, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.the character length of the stream length)Sets the character length of the stream, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.the descriptor to copy csd)Copies the state of the specified descriptor. |
| public CharacterStreamDescriptor. | Returns: The builder.the current byte position pos)Sets the current byte position, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.the current character position,starting at pos)1Sets the current character position, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.first index with user data, zero based offset)Sets the offset of the user data, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.maximum number of characters length)Imposes a length limit on the stream, expressed in number of
characters, defaults to |
| public CharacterStreamDescriptor. | Returns: The builder.true if the stream can reposition
itself, false if notSets if the stream can reposition itself or not, defaults to
|
| public CharacterStreamDescriptor. | Returns: The builder.the stream stream)Sets the stream described by the descriptor. |
| public String | Returns: The textual representation of the builder.Overrides java. Returns a textual representation of the builder. |
| bufferable | back to summary |
|---|---|
| private boolean bufferable | |
| byteLength | back to summary |
|---|---|
| private long byteLength | |
| charLength | back to summary |
|---|---|
| private long charLength | |
| curBytePos | back to summary |
|---|---|
| private long curBytePos | |
| curCharPos | back to summary |
|---|---|
| private long curCharPos | |
| dataOffset | back to summary |
|---|---|
| private long dataOffset | |
| DEFAULT_MAX_CHAR_LENGTH | back to summary |
|---|---|
| private static final long DEFAULT_MAX_CHAR_LENGTH Default max character length is unlimited. | |
| maxCharLength | back to summary |
|---|---|
| private long maxCharLength | |
| positionAware | back to summary |
|---|---|
| private boolean positionAware | |
| stream | back to summary |
|---|---|
| private InputStream stream | |
| Builder | back to summary |
|---|---|
| public Builder() Creates a builder object. | |
| bufferable | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets if the stream should be buffered, defaults to
| |
| build | back to summary |
|---|---|
| public CharacterStreamDescriptor build() Creates a descriptor object based on the parameters kept in the builder instance. Default values will be used for parameters for which a value hasn't been set. Note Parameter validation is only performed in sane builds.
| |
| byteLength | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the byte length of the stream, defaults to
A length of
| |
| charLength | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the character length of the stream, defaults to
Headers are not included in this length, only the user data.
A length of
| |
| copyState | back to summary |
|---|---|
| public CharacterStreamDescriptor. Copies the state of the specified descriptor.
| |
| curBytePos | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the current byte position, defaults to
| |
| curCharPos | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the current character position, defaults to
There is a special value for when the stream is position in the
header area -
| |
| dataOffset | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the offset of the user data, defaults to
| |
| maxCharLength | back to summary |
|---|---|
| public CharacterStreamDescriptor. Imposes a length limit on the stream, expressed in number of
characters, defaults to
| |
| positionAware | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets if the stream can reposition itself or not, defaults to
| |
| stream | back to summary |
|---|---|
| public CharacterStreamDescriptor. Sets the stream described by the descriptor.
The stream is not allowed to be
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a textual representation of the builder.
| |