com.ibm.jzos
Class RDWInputRecordStream
- java.lang.Object
-
- com.ibm.jzos.RDWInputRecordStream
-
public class RDWInputRecordStream extends java.lang.Object
This 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 void
close()
Close the underlying InputStreambyte[]
read()
Read the next record and return as a new byte arrayint
read(byte[] bytes)
Read the next record into the supplied byte array.int
read(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.IOException
Close the underlying InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bytes) throws java.io.IOException
Read 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.IOException
Read 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.IOException
Read 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
-
-