Package org.apache.derby.iapi.jdbc
Class CharacterStreamDescriptor.Builder
java.lang.Object
org.apache.derby.iapi.jdbc.CharacterStreamDescriptor.Builder
- Enclosing class:
CharacterStreamDescriptor
The builder for the
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private long
private long
private long
private long
private long
private static final long
Default max character length is unlimited.private long
private boolean
private InputStream
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbufferable
(boolean bufferable) Sets if the stream should be buffered, defaults tofalse
.build()
Creates a descriptor object based on the parameters kept in the builder instance.byteLength
(long length) Sets the byte length of the stream, defaults to0
.charLength
(long length) Sets the character length of the stream, defaults to0
.Copies the state of the specified descriptor.curBytePos
(long pos) Sets the current byte position, defaults to0
.curCharPos
(long pos) Sets the current character position, defaults to1
.dataOffset
(long offset) Sets the offset of the user data, defaults to0
.maxCharLength
(long length) Imposes a length limit on the stream, expressed in number of characters, defaults toLong.MAX_VALUE
.positionAware
(boolean positionAware) Sets if the stream can reposition itself or not, defaults tofalse
.stream
(InputStream stream) Sets the stream described by the descriptor.toString()
Returns a textual representation of the builder.
-
Field Details
-
DEFAULT_MAX_CHAR_LENGTH
private static final long DEFAULT_MAX_CHAR_LENGTHDefault max character length is unlimited.- See Also:
-
bufferable
private boolean bufferable -
positionAware
private boolean positionAware -
curBytePos
private long curBytePos -
curCharPos
private long curCharPos -
byteLength
private long byteLength -
charLength
private long charLength -
dataOffset
private long dataOffset -
maxCharLength
private long maxCharLength -
stream
-
-
Constructor Details
-
Builder
public Builder()Creates a builder object.
-
-
Method Details
-
bufferable
Sets if the stream should be buffered, defaults tofalse
.- Parameters:
bufferable
-true
if buffering is advised,false
if not- Returns:
- The builder.
-
positionAware
Sets if the stream can reposition itself or not, defaults tofalse
.- Parameters:
positionAware
-true
if the stream can reposition itself,false
if not- Returns:
- The builder.
-
curBytePos
Sets the current byte position, defaults to0
.- Parameters:
pos
- the current byte position- Returns:
- The builder.
-
curCharPos
Sets the current character position, defaults to1
.There is a special value for when the stream is position in the header area -
BEFORE_FIRST
.- Parameters:
pos
- the current character position,starting at1
- Returns:
- The builder.
- See Also:
-
byteLength
Sets the byte length of the stream, defaults to0
.A length of
0
means the length is unknown.- Parameters:
length
- the byte length of the stream (including header)- Returns:
- The builder.
-
copyState
Copies the state of the specified descriptor.- Parameters:
csd
- the descriptor to copy- Returns:
- The builder.
-
charLength
Sets the character length of the stream, defaults to0
.Headers are not included in this length, only the user data. A length of
0
means the length is unknown.- Parameters:
length
- the character length of the stream- Returns:
- The builder.
-
dataOffset
Sets the offset of the user data, defaults to0
.- Parameters:
offset
- first index with user data, zero based- Returns:
- The builder.
-
maxCharLength
Imposes a length limit on the stream, expressed in number of characters, defaults toLong.MAX_VALUE
.- Parameters:
length
- maximum number of characters- Returns:
- The builder.
-
stream
Sets the stream described by the descriptor.The stream is not allowed to be
null
.- Parameters:
stream
- the stream- Returns:
- The builder.
-
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.
- Returns:
- A character stream descriptor instance.
-
toString
Returns a textual representation of the builder.
-