com.ibm.as400.access
Class LineDataRecordWriter

java.lang.Object
  extended by com.ibm.as400.access.LineDataRecordWriter

public class LineDataRecordWriter
extends 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

Constructor Summary
Constructor and Description
LineDataRecordWriter(OutputStream out, AS400 system)
          Constructs a LineDataRecordWriter.
LineDataRecordWriter(OutputStream out, int ccsid, AS400 system)
          Constructs a LineDataRecordWriter.
 
Method Summary
Modifier and Type Method and Description
 int getCcsid()
          Gets the CCSID used for this writer.
 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
 

Constructor Detail

LineDataRecordWriter

public LineDataRecordWriter(OutputStream out,
                            AS400 system)
                     throws UnsupportedEncodingException
Constructs a LineDataRecordWriter. The target CCSID defaults to the CCSID of the system.

Parameters:
out - An OutputStream.
system - The system.
Throws:
UnsupportedEncodingException - If ccsid is not valid.

LineDataRecordWriter

public LineDataRecordWriter(OutputStream out,
                            int ccsid,
                            AS400 system)
                     throws UnsupportedEncodingException
Constructs a LineDataRecordWriter.

Parameters:
out - An OutputStream.
ccsid - The name of the target CCSID to be used.
system - The system.
Throws:
UnsupportedEncodingException - If ccsid is not valid.
Method Detail

getCcsid

public int getCcsid()
Gets the CCSID used for this writer.

Returns:
The CCSID used for this writer.

getEncoding

public 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 IOException,
                        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. 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:
IOException - If an error occurs while communicating with the AS/400.
UnsupportedEncodingException - If in not valid.
ExtendedIllegalStateException
See Also:
Record