com.ibm.jzos
Class RDWInputRecordStream
- java.lang.Object
-
- com.ibm.jzos.RDWInputRecordStream
-
public class RDWInputRecordStream extends java.lang.ObjectThis class is a wrapper that returns RDW (Record Descriptor Word) delineated records from an InputStream.For example usage, see the sample class:
com.ibm.jzos.sample.dfsort.DfSortVariableDatasetToJava- Since:
- 2.1.0
-
-
Constructor Summary
Constructors Constructor and Description RDWInputRecordStream(java.io.InputStream is)Construct an instance of RDWInputRecordStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Close the underlying InputStreambyte[]read()Read the next record and return as a new byte arrayintread(byte[] bytes)Read the next record into the supplied byte array.intread(byte[] bytes, int offset)Read the next record into the supplied byte array starting at offset.
-
-
-
Constructor Detail
-
RDWInputRecordStream
public RDWInputRecordStream(java.io.InputStream is)
Construct an instance of RDWInputRecordStream. Supplying a BufferedInputStream wrapper will generally result in better performance.- Parameters:
is- the InputStream containing RDW delineated records
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionClose the underlying InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bytes) throws java.io.IOExceptionRead the next record into the supplied byte array.- Parameters:
bytes- the byte[] to read the record into- Returns:
- int the length of the record or -1 if EOF
- Throws:
java.io.IOException- if the supplied byte[] is too small to hold the record or if an exception occurs on the underlying InputStream
-
read
public int read(byte[] bytes, int offset) throws java.io.IOExceptionRead the next record into the supplied byte array starting at offset.- Parameters:
bytes- the byte[] to read the record into- Returns:
- int the length of the record or -1 if EOF
- Throws:
java.io.IOException- if the supplied byte[] is too small to hold the record or if an exception occurs on the underlying InputStream
-
read
public byte[] read() throws java.io.IOExceptionRead the next record and return as a new byte arrayThis method creates a new byte array for each record sized to match the exact record length. For better performance, use
read(byte[]).- Returns:
- byte[] the record or null if EOF
- Throws:
java.io.IOException- if the supplied byte[] is too small to hold the record or if an exception occurs on the underlying InputStream
-
-