com.ibm.as400.access
Class LineDataRecordWriter
- java.lang.Object
-
- com.ibm.as400.access.LineDataRecordWriter
-
public class LineDataRecordWriter extends java.lang.Object
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
Constructors Constructor and Description LineDataRecordWriter(java.io.OutputStream out, AS400 system)
Constructs a LineDataRecordWriter.LineDataRecordWriter(java.io.OutputStream out, int ccsid, AS400 system)
Constructs a LineDataRecordWriter.
-
Method Summary
Methods Modifier and Type Method and Description 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.
-
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
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 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:- ATTR_CONTROL_CHARACTER - Forms Control Character set to *NONE
- ATTR_CONVERT_LINE_DATA - Convert Line Data set to *YES
- ATTR_FORM_DEFINITION - Form definition integrated file system name
- ATTR_PAGE_DEFINITION - Page definition integrated file system name
- ATTR_PRTDEVTYPE - Printer device type set to *LINE
- 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 ccsid is not valid.ExtendedIllegalStateException
- If a state is illegal.- See Also:
Record
-
-