com.ibm.as400.access
Class LineDataRecordWriter
java.lang.Object
|
+--com.ibm.as400.access.LineDataRecordWriter
- public class LineDataRecordWriter
- extends java.lang.Object
The LineDataRecordWriter class writes a record in line data format (with
the name of the record format inserted into positions 1-10 of the line data),
translating characters into bytes of the specified CCSID.
The line data is written to an OutputStream.
- See Also:
OutputStream
Method Summary |
int |
getCcsid()
Gets the CCSID used for this writer. |
java.lang.String |
getEncoding()
Gets the name of the encoding being used by this LineDataRecordWriter. |
void |
writeRecord(Record record)
Writes the record data, in line data format, to an OutputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LineDataRecordWriter
public LineDataRecordWriter(java.io.OutputStream out,
AS400 system)
throws java.io.UnsupportedEncodingException
- Constructs a LineDataRecordWriter. The target CCSID defaults to the CCSID
of the system.
- Parameters:
out
- An OutputStream.system
- The system.- Throws:
java.io.UnsupportedEncodingException
- If ccsid is not valid.
LineDataRecordWriter
public LineDataRecordWriter(java.io.OutputStream out,
int ccsid,
AS400 system)
throws java.io.UnsupportedEncodingException
- Constructs a LineDataRecordWriter.
- Parameters:
out
- An OutputStream.ccsid
- The name of the target CCSID to be used.system
- The system.- Throws:
java.io.UnsupportedEncodingException
- If ccsid is not valid.
getCcsid
public int getCcsid()
- Gets the CCSID used for this writer.
- Returns:
- The CCSID used for this writer.
getEncoding
public java.lang.String getEncoding()
- Gets the name of the encoding being used by this LineDataRecordWriter.
- Returns:
- The name of the encoding being used by this LineDataRecordWriter.
Null may be returned if the stream is closed.
writeRecord
public void writeRecord(Record record)
throws java.io.IOException,
java.io.UnsupportedEncodingException,
ExtendedIllegalStateException
- Writes the record data, in line data format, to an OutputStream.
The data is translated into bytes using the specified CCSID. The format
of the data is determined by the record format associated with the record.
The following record format attributes are required to be set.
- Record format ID
- Record format type
For a record created with record format type of VARIABLE_LAYOUT_LENGTH,
the record format delimiter must be specified.
For a record created
with a format type of FIXED_LAYOUT_LENGTH, the field description layout
attributes, length and alignment must be specified. If alignment is not
specified, alignment will be defaulted to ALIGN_LEFT.
If the OutputStream is a SpooledFileOutputStream, the SpooledFileOutputStream
must have the following parameters set:
- Parameters:
record
- The record to be converted to line data.- Throws:
java.io.IOException
- If an error occurs while communicating
with the AS/400.java.io.UnsupportedEncodingException
- If in not valid.- See Also:
Record