java.lang.Object
com.ibm.jzos.CatalogSearchField
A wrapper around the bytes for a specific field returned from a CatalogSearch request Dataset Entry.
This class provides a set of helper methods to convert the raw byte data into the
expected data types.
- Since:
- 2.1.0
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBytes()
Return the raw field bytes.char
getChar()
Return a char constructed from the field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.Return a String constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.String[]
getFStringArray
(int len) Return an array of fixed length Strings constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.int
getInt()
Return an integer constructed from the bytes in the field.int[]
getIntArray
(int len) Return an array of integers constructed from the bytes in the field.int
Return the length of the field.getName()
Return the field name.Return a String constructed from the field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
, skipping the lengthField.String[]
Return an array of Strings constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
skipping the lengthField.boolean
Convenience method to test if a fixed field is 0x'FF' filled, indicating that the requested data is missing.boolean
Convenience method to test if a field has been suppressed due to insufficient access permission.
-
Method Details
-
getBytes
public byte[] getBytes()Return the raw field bytes. -
getLength
public int getLength()Return the length of the field. As per the documentation, the following lengths have special meaning:- -1 The data to be retrieved has been suppressed; security data will be suppressed if the caller does not have the proper RACF authority.
- 0 No data was found for this entry. This can happen, for instance, if the data does not apply to the particular entry type being supplied.
- 2 or 4 The data field to be retrieved has variable length and does not exist. Data with variable length is always returned with length information preceding the data and is included as part of data. Therefore, when the field to be retrieved does not exist, this preceding length information is set to 0 and the total length of the data returned will then be the length of this preceding length information.
- n The data field to be retrieved has fixed length. If the data does not exist for this Dataset, all of the bytes will be set to 0xFF.
- n The data is retrieved has variable length. n is the length of the data retrieved, including the length prefix.
-
getName
Return the field name. -
getChar
public char getChar()Return a char constructed from the field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.- Throws:
IllegalStateException
- if the field length != 1.
-
getFString
Return a String constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.The returned String will have trailing space trimmed.
If the field length is -1 (suppressed) or 0, null is returned. See
getLength()
andisSuppressed()
. -
getInt
public int getInt()Return an integer constructed from the bytes in the field.- Throws:
IllegalStateException
- if the length of the field is less than 1 or greater than 4 bytes
-
getIntArray
public int[] getIntArray(int len) Return an array of integers constructed from the bytes in the field.If the field length is -1 (suppressed) or 0, null is returned. See
getLength()
andisSuppressed()
.- Parameters:
len
- the length of a single field, a number between 1 and 4. If len is between 1 and 3, the values are returned as unsigned integers. If len is 4, the returned values will be signed.- Returns:
- an int[] where each element is the corresponding byte sequence interpreted as a big endian integer value
- Throws:
IllegalStateException
- if the length of the field is not a multiple of len or if len is a value less than 1 or greater than 4.
-
getFStringArray
Return an array of fixed length Strings constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
.The returned Strings will have trailing space trimmed.
If the field length is -1 (suppressed) or 0, null is returned. See
getLength()
andisSuppressed()
.- Parameters:
len
- the length of a single String field- Throws:
IllegalStateException
- if the length of the field is not a multiple of len
-
getVStringArray
Return an array of Strings constructed from the entire field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
skipping the lengthField.This method assumes that each individual field is preceded by its length.
If the field length is -1 (suppressed) or 0, null is returned. See
getLength()
andisSuppressed()
. -
getVString
Return a String constructed from the field using the default EBCDIC encoding ofZFileConstants.DEFAULT_EBCDIC_CODE_PAGE
, skipping the lengthField.If the field length is -1 (suppressed) or 0, null is returned. See
getLength()
andisSuppressed()
. -
isFixedMissing
public boolean isFixedMissing()Convenience method to test if a fixed field is 0x'FF' filled, indicating that the requested data is missing.- Returns:
- true if all of the bytes in the field are set to '0xFF'
-
isSuppressed
public boolean isSuppressed()Convenience method to test if a field has been suppressed due to insufficient access permission.- Returns:
- true if the field has been suppressed, false otherwise
-