public static class CharacterStreamDescriptor.Builder
extends java.lang.Object
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 | Description |
---|---|---|
private boolean |
bufferable |
|
private long |
byteLength |
|
private long |
charLength |
|
private long |
curBytePos |
|
private long |
curCharPos |
|
private long |
dataOffset |
|
private static long |
DEFAULT_MAX_CHAR_LENGTH |
Default max character length is unlimited.
|
private long |
maxCharLength |
|
private boolean |
positionAware |
|
private java.io.InputStream |
stream |
Constructor | Description |
---|---|
Builder() |
Creates a builder object.
|
Modifier and Type | Method | Description |
---|---|---|
CharacterStreamDescriptor.Builder |
bufferable(boolean bufferable) |
Sets if the stream should be buffered, defaults to
false . |
CharacterStreamDescriptor |
build() |
Creates a descriptor object based on the parameters kept in the
builder instance.
|
CharacterStreamDescriptor.Builder |
byteLength(long length) |
Sets the byte length of the stream, defaults to
0 . |
CharacterStreamDescriptor.Builder |
charLength(long length) |
Sets the character length of the stream, defaults to
0 . |
CharacterStreamDescriptor.Builder |
copyState(CharacterStreamDescriptor csd) |
Copies the state of the specified descriptor.
|
CharacterStreamDescriptor.Builder |
curBytePos(long pos) |
Sets the current byte position, defaults to
0 . |
CharacterStreamDescriptor.Builder |
curCharPos(long pos) |
Sets the current character position, defaults to
1 . |
CharacterStreamDescriptor.Builder |
dataOffset(long offset) |
Sets the offset of the user data, defaults to
0 . |
CharacterStreamDescriptor.Builder |
maxCharLength(long length) |
Imposes a length limit on the stream, expressed in number of
characters, defaults to
Long.MAX_VALUE . |
CharacterStreamDescriptor.Builder |
positionAware(boolean positionAware) |
Sets if the stream can reposition itself or not, defaults to
false . |
CharacterStreamDescriptor.Builder |
stream(java.io.InputStream stream) |
Sets the stream described by the descriptor.
|
java.lang.String |
toString() |
Returns a textual representation of the builder.
|
private static final long DEFAULT_MAX_CHAR_LENGTH
private boolean bufferable
private boolean positionAware
private long curBytePos
private long curCharPos
private long byteLength
private long charLength
private long dataOffset
private long maxCharLength
private java.io.InputStream stream
public CharacterStreamDescriptor.Builder bufferable(boolean bufferable)
false
.bufferable
- true
if buffering is advised, false
if notpublic CharacterStreamDescriptor.Builder positionAware(boolean positionAware)
false
.positionAware
- true
if the stream can reposition
itself, false
if notpublic CharacterStreamDescriptor.Builder curBytePos(long pos)
0
.pos
- the current byte positionpublic CharacterStreamDescriptor.Builder curCharPos(long pos)
1
.
There is a special value for when the stream is position in the
header area - BEFORE_FIRST
.
pos
- the current character position,starting at 1
CharacterStreamDescriptor.BEFORE_FIRST
public CharacterStreamDescriptor.Builder byteLength(long length)
0
.
A length of 0
means the length is unknown.
length
- the byte length of the stream (including header)public CharacterStreamDescriptor.Builder copyState(CharacterStreamDescriptor csd)
csd
- the descriptor to copypublic CharacterStreamDescriptor.Builder charLength(long length)
0
.
Headers are not included in this length, only the user data.
A length of 0
means the length is unknown.
length
- the character length of the streampublic CharacterStreamDescriptor.Builder dataOffset(long offset)
0
.offset
- first index with user data, zero basedpublic CharacterStreamDescriptor.Builder maxCharLength(long length)
Long.MAX_VALUE
.length
- maximum number of characterspublic CharacterStreamDescriptor.Builder stream(java.io.InputStream stream)
The stream is not allowed to be null
.
stream
- the streampublic CharacterStreamDescriptor build()
Default values will be used for parameters for which a value hasn't been set.
NOTE: Parameter validation is only performed in sane builds.
public java.lang.String toString()
toString
in class java.lang.Object
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.