All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.access.SpooledFileOutputStream
java.lang.Object
|
+----java.io.OutputStream
|
+----com.ibm.as400.access.SpooledFileOutputStream
- public class SpooledFileOutputStream
- extends OutputStream
The SpooledFileOutputStream class is used to write data into an AS/400 spooled file.
-
SpooledFileOutputStream(AS400, PrintParameterList, PrinterFile, OutputQueue)
- Constructs a SpooledFileOutputStream object.
-
close()
- Closes the stream.
-
finalize()
- Closes the stream when garbage is collected.
-
flush()
- Flushes the stream.
-
getSpooledFile()
- Returns the spooled file that was created (or is being created) with
this output stream.
-
write(byte[])
- Writes data.length bytes of data from the byte array
data to the spooled file.
-
write(byte[], int, int)
- Writes up to length bytes of data from the byte array data,
starting at offset, to this spooled file.
-
write(int)
- Writes a byte of data.
SpooledFileOutputStream
public SpooledFileOutputStream(AS400 system,
PrintParameterList options,
PrinterFile printerFile,
OutputQueue outputQueue) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException
- Constructs a SpooledFileOutputStream object.
Use this object to create a new spooled file on the given AS/400
with the specified parameters.
- Parameters:
- system - The system on which to create the spooled file.
- options - Optional. A print parameter list that contains
a list of attributes with which to create the spooled file.
The attributes set in options will
override those attributes in the printer file that is used.
The printer file used will be the one specified with the
printerFile parameter, or if that parameter is null,
it will be the default network print server printer file (QPNPSPRTF).
If the output queue is specified in options, it
will override any output queue passed in the outputQueue
parameter.
The following parameters may be set:
Note 1: Code page and graphical character set are dependent upon each
other. If you set one you must set the other.
Note 2: The special value of *FILE is not allowed when creating a new
spooled file.
Note 3: Up to 4 user-defined options may be specified.
- printerFile - Optional. The printer file that should be used
to create the spooled file. This printer file
must reside on the same AS400 system that the
spooled file is being created.
- outputQueue - Optional. The output queue on which to create the
spooled file. The output queue must reside on
the same AS400 system that the spooled file
is being created.
- Returns:
- An output stream that can be used to write data into the spooled
file and to close the spooled file.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: InterruptedException
- If this thread is interrupted.
close
public void close() throws IOException
- Closes the stream.
It must be called to release any resources associated with the stream.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Overrides:
- close in class OutputStream
finalize
protected void finalize() throws Throwable
- Closes the stream when garbage is collected.
- Throws: Throwable
- If an error occurs.
- Overrides:
- finalize in class Object
flush
public void flush() throws IOException
- Flushes the stream. This will write any buffered output bytes.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Overrides:
- flush in class OutputStream
getSpooledFile
public synchronized SpooledFile getSpooledFile() throws IOException
- Returns the spooled file that was created (or is being created) with
this output stream.
- Returns:
- A reference to the spooled file object.
write
public synchronized void write(int b) throws IOException
- Writes a byte of data.
- Parameters:
- b - The byte to be written.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Overrides:
- write in class OutputStream
write
public void write(byte data[]) throws IOException
- Writes data.length bytes of data from the byte array
data to the spooled file.
- Parameters:
- data - The data to be written.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Overrides:
- write in class OutputStream
write
public synchronized void write(byte data[],
int offset,
int length) throws IOException
- Writes up to length bytes of data from the byte array data,
starting at offset, to this spooled file.
- Parameters:
- data - The data to be written.
- offset - The start offset in the data.
- length - The number of bytes that are written.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Overrides:
- write in class OutputStream
All Packages Class Hierarchy This Package Previous Next Index