|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.jzos.fields.StringField
public class StringField
A String Field
.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_ENCODING
|
static char |
HIGH_VALUE
The Unicode character that translates to EBCDIC 0xFF using Cp1047 |
Constructor Summary | |
---|---|
StringField(int offset,
int length)
Construct an instance with trim=true, padLeft=false, and allowTruncation=true. |
|
StringField(int offset,
int length,
boolean trim)
Construct an instance with padLeft=false and allowTruncation=true. |
|
StringField(int offset,
int length,
boolean trim,
boolean padLeft)
Construct an instance with allowTruncation=true. |
|
StringField(int offset,
int length,
boolean trim,
boolean padLeft,
boolean allowTruncation)
Construct an instance. |
|
StringField(int offset,
int length,
boolean trim,
boolean padLeft,
boolean allowTruncation,
java.lang.String encoding)
Construct an instance. |
Method Summary | |
---|---|
boolean |
equals(java.lang.String aString1,
java.lang.String aString2)
Compare two Strings, possible null, for equality. |
int |
getByteLength()
Answer the length of the field described by the receiver |
java.lang.String |
getEncoding()
Return the configured (EBCDIC variant) encoding for this field. |
int |
getOffset()
Answer the offset of this field into some array of bytes |
java.lang.String |
getString(byte[] bytes)
Return a String from the given byte array buffer, at the offset of this field. |
java.lang.String |
getString(byte[] bytes,
int bufOffset)
Return a String from the given byte array buffer, at the bufOffset + offset of this field. |
boolean |
isAllowTruncation()
|
boolean |
isPadLeft()
|
boolean |
isTrim()
|
static java.lang.String |
makeString(int len,
char ch)
A static helper method which answers a new String of a given size and filled with a given character. |
void |
putString(java.lang.String string,
byte[] bytes)
Put a String into the given byte array buffer, at the offset of this field. |
void |
putString(java.lang.String string,
byte[] bytes,
int bufOffset)
Put a String into the given byte array buffer, at the bufOffset + offset of this field. |
void |
setAllowTruncation(boolean allowTruncation)
Set whether or not to allow truncation of String values larger than the underlying byte length. |
void |
setByteLength(int len)
Sets the byte length of the field |
void |
setEncoding(java.lang.String encoding)
Set the (EBCDIC variant) encoding for this field. |
void |
setOffset(int offset)
|
void |
setPadLeft(boolean padLeft)
Set to true if the field will right justify String values that are shorter than the underlying field length. |
void |
setTrim(boolean trim)
Set to true if the String value obtained from the underlying byte array are to be blank trimmed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char HIGH_VALUE
public static final java.lang.String DEFAULT_ENCODING
Constructor Detail |
---|
public StringField(int offset, int length)
offset
- int the offset in some byte array to the start of this fieldlength
- int the size of the field in bytespublic StringField(int offset, int length, boolean trim)
offset
- int the offset in some byte array to the start of this fieldlength
- int the size of the field in bytestrim
- true if the String returned from the underlying byte array is to be trimmed of
leading (padLeft == true) or trailing (padLeft == false) blanks.public StringField(int offset, int length, boolean trim, boolean padLeft)
offset
- int the offset in some byte array to the start of this fieldlength
- int the size of the field in bytestrim
- 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 blankspublic StringField(int offset, int length, boolean trim, boolean padLeft, boolean allowTruncation)
offset
- int the offset in some byte array to the start of this fieldlength
- int the size of the field in bytestrim
- 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(int offset, int length, boolean trim, boolean padLeft, boolean allowTruncation, java.lang.String encoding)
offset
- int the offset in some byte array to the start of this fieldlength
- int the size of the field in bytestrim
- 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.Method Detail |
---|
public static java.lang.String makeString(int len, char ch)
len
- the length of the String to createch
- the character which will fill the Stringpublic int getByteLength()
Field
getByteLength
in interface Field
Field.getByteLength()
public void setByteLength(int len)
public int getOffset()
Field
getOffset
in interface Field
Field.getOffset()
public void setOffset(int offset)
setOffset
in interface Field
Field.setOffset(int)
public java.lang.String getString(byte[] bytes)
bytes
- the byte array
public java.lang.String getString(byte[] bytes, int bufOffset)
bytes
- the byte arraybufOffset
- the additional offset into the byte array
public void putString(java.lang.String string, byte[] bytes)
string
- the String valuebytes
- the byte array
java.lang.IllegalArgumentException
- if the String value is too long to fit into
the buffer and allowTruncation == false.
java.lang.RuntimeException
- if the configured encoding is not supportedpublic void putString(java.lang.String string, byte[] bytes, int bufOffset)
string
- the String valuebytes
- the byte arraybufOffset
- the additional offset into the byte array
java.lang.IllegalArgumentException
- if the String value is too long to fit into
the buffer and allowTruncation == false.
java.lang.RuntimeException
- if the configured encoding is not supportedpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding
- the EBCDIC encodingpublic boolean isAllowTruncation()
public void setAllowTruncation(boolean allowTruncation)
allowTruncation
- public boolean isPadLeft()
public void setPadLeft(boolean padLeft)
public boolean isTrim()
public void setTrim(boolean trim)
public boolean equals(java.lang.String aString1, java.lang.String aString2)
aString1
- aString2
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |