java.lang.Object
com.blackhillsoftware.zutil.io.RecordReader
com.blackhillsoftware.zutil.io.TextRecordReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
Class to read records from z/OS datasets as Strings.
Uses the
com.ibm.jzos.RecordReader
class to read the data
and com.ibm.jzos.fields.StringField
to convert the records to Strings.-
Method Summary
Modifier and TypeMethodDescriptionGet the encoding used to convert the data to a Java stringstatic TextRecordReader
Construct a new TextRecordReader using the same syntax ascom.ibm.jzos.RecordReader.newReader(String name, int flags)
static TextRecordReader
newReaderForDD
(String ddname) Construct a new TextRecordReader using the same syntax ascom.ibm.jzos.RecordReader.newReaderForDD(String ddname)
int
read
(byte[] buf) TextRecordReader does not support writing byte dataint
read
(byte[] buf, int offset, int len) TextRecordReader does not support writing byte dataRead all records from the current position to the end of the datasetreadLine()
Read the next record from the datasetsetEncoding
(String encoding) Set the EBCDIC variant encoding used to convert the data to a Java stringMethods inherited from class com.blackhillsoftware.zutil.io.RecordReader
close, getAutoFree, getBlksize, getDDName, getDsn, getLrecl, getRecfm, getRecfmBits, setAutoFree
-
Method Details
-
newReader
Construct a new TextRecordReader using the same syntax ascom.ibm.jzos.RecordReader.newReader(String name, int flags)
- Throws:
IOException
- if the JZOS native call fails
-
newReaderForDD
Construct a new TextRecordReader using the same syntax ascom.ibm.jzos.RecordReader.newReaderForDD(String ddname)
- Throws:
IOException
- if the JZOS native call fails
-
setEncoding
Set the EBCDIC variant encoding used to convert the data to a Java string- Parameters:
encoding
- the EBCDIC encoding e.g. "Cp1047"- Returns:
- this TextRecordReader to allow fluent style usage
-
getEncoding
Get the encoding used to convert the data to a Java string- Returns:
- String the encoding value
-
readLine
Read the next record from the dataset- Returns:
- String the record, converted to a Java String
- Throws:
IOException
-
readAllLines
Read all records from the current position to the end of the dataset- Returns:
- List<String> a list of records converted to Java Strings
- Throws:
IOException
-
read
public int read(byte[] buf) TextRecordReader does not support writing byte data- Overrides:
read
in classRecordReader
-
read
public int read(byte[] buf, int offset, int len) TextRecordReader does not support writing byte data- Overrides:
read
in classRecordReader
-