public abstract class DatatypeFactory
extends java.lang.Object
Field
objects. A running offset to the next field is maintained, along with a
stack which can be used to push and pop the current Field offset.
A DatatypeFactory is typically used to statically initialize static
Field variables in a Java class which maps a record described by a byte array.
For an example, see Format1DSCB
.
Constructor and Description |
---|
DatatypeFactory() |
Modifier and Type | Method and Description |
---|---|
ByteArrayField |
getByteArrayField(int length)
Construct and return a ByteArrayField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigDecimalField |
getExternalDecimalAsBigDecimalField(int precision,
int scale,
boolean signed)
Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigDecimalField |
getExternalDecimalAsBigDecimalField(int precision,
int scale,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsBigDecimalField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigIntegerField |
getExternalDecimalAsBigIntegerField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
|
ExternalDecimalAsBigIntegerField |
getExternalDecimalAsBigIntegerField(int precision,
int scale,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsBigIntegerField, advancing the current offset by its byte length.
|
ExternalDecimalAsIntField |
getExternalDecimalAsIntField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
|
ExternalDecimalAsIntField |
getExternalDecimalAsIntField(int precision,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsIntField, advancing the current offset by its byte length.
|
ExternalDecimalAsLongField |
getExternalDecimalAsLongField(int precision,
boolean signed)
Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
|
ExternalDecimalAsLongField |
getExternalDecimalAsLongField(int precision,
boolean signed,
boolean signTrailing,
boolean signExternal,
boolean blankWhenZero)
Construct and return a ExternalDecimalAsLongField, advancing the current offset by its byte length.
|
int |
getMaximumOffset()
Answer the maximum value of the offset
|
int |
getOffset()
Answer the current (next) Field offset
|
java.lang.String |
getStringEncoding()
Gets the current String encoding used for construction of StringFields.
|
StringField |
getStringField(int length)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft,
boolean allowTruncation)
Construct and return a StringField, advancing the current offset by its byte length.
|
StringField |
getStringField(int length,
boolean trim,
boolean padLeft,
boolean allowTruncation,
java.lang.String encoding)
Construct and return a StringField, advancing the current offset by its byte length.
|
boolean |
getStringTrimDefault()
Answer the default setting for StringField trimming if
not explicitly given.
|
void |
incrementOffset(int amount)
Increments the current Field offset
|
void |
popOffset()
Pop the Field offset from the top of an internal stack.
|
void |
pushOffset()
Push the current Field offset onto an internal stack.
|
void |
setOffset(int offset) |
void |
setStringEncoding(java.lang.String stringEncoding) |
void |
setStringTrimDefault(boolean value) |
public int getOffset()
public int getMaximumOffset()
public void setOffset(int offset)
getOffset()
public void pushOffset()
popOffset()
public void popOffset()
pushOffset()
public void incrementOffset(int amount)
amount
- intpublic java.lang.String getStringEncoding()
StringField.getEncoding()
public boolean getStringTrimDefault()
public void setStringTrimDefault(boolean value)
getStringTrimDefault()
public void setStringEncoding(java.lang.String stringEncoding)
getStringEncoding()
public ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed)
precision
- the number of decimal digits of precisionscale
- the number of implied decimal digits to the right of the decimal pointsigned
- boolean true if the value is signedExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsBigDecimalField getExternalDecimalAsBigDecimalField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision
- the number of decimal digits of precisionscale
- the number of implied decimal digits to the right of the decimal pointsigned
- boolean true if the value is signedsignTrailing
- true if the sign is stored at the end of the fieldsignExternal
- true if the sign is stored in a separate byteblankWhenZero
- true if the field is all spaces when zeroExternalDecimalAsBigDecimalField.ExternalDecimalAsBigDecimalField(int, int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision, boolean signed)
precision
- the number of decimal digits of precisionsigned
- boolean true if the value is signedExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsBigIntegerField getExternalDecimalAsBigIntegerField(int precision, int scale, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision
- the number of decimal digits of precisionscale
- the number of implied decimal digits to the right of the decimal pointsigned
- boolean true if the value is signedsignTrailing
- true if the sign is stored at the end of the fieldsignExternal
- true if the sign is stored in a separate byteblankWhenZero
- true if the field is all spaces when zeroExternalDecimalAsBigIntegerField.ExternalDecimalAsBigIntegerField(int, int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision, boolean signed)
precision
- the number of decimal digits of precisionsigned
- boolean true if the value is signedExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsIntField getExternalDecimalAsIntField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision
- the number of decimal digits of precisionsigned
- boolean true if the value is signedsignTrailing
- true if the sign is stored at the end of the fieldsignExternal
- true if the sign is stored in a separate byteblankWhenZero
- true if the field is all spaces when zeroExternalDecimalAsIntField.ExternalDecimalAsIntField(int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision, boolean signed)
precision
- the number of decimal digits of precisionsigned
- boolean true if the value is signedExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)
public ExternalDecimalAsLongField getExternalDecimalAsLongField(int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
precision
- the number of decimal digits of precisionsigned
- boolean true if the value is signedsignTrailing
- true if the sign is stored at the end of the fieldsignExternal
- true if the sign is stored in a separate byteblankWhenZero
- true if the field is all spaces when zeroExternalDecimalAsLongField.ExternalDecimalAsLongField(int, int, boolean, boolean, boolean, boolean)
public ByteArrayField getByteArrayField(int length)
length
- the size of the field in bytesByteArrayField.ByteArrayField(int, int)
public StringField getStringField(int length)
length
- the length of the field in bytes.public StringField getStringField(int length, boolean trim)
length
- trim
- StringField.StringField(int, int, boolean)
public StringField getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation, java.lang.String encoding)
length
- the length of the field in bytes.trim
- true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft
- true if small values are to be left padded with blanksallowTruncation
- true if large Strings are to be right truncated. If false an
IllegalArgumentException will be thrown.encoding
- the character set encoding. This is assumed to be an EBCDIC variant.public StringField getStringField(int length, boolean trim, boolean padLeft, boolean allowTruncation)
length
- the length of the field in bytes.trim
- true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft
- true if small values are to be left padded with blanksallowTruncation
- true if large Strings are to be right truncated. If false an
IllegalArgumentException will be thrown.public StringField getStringField(int length, boolean trim, boolean padLeft)
length
- the length of the field in bytes.trim
- true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.padLeft
- true if small values are to be left padded with blanks