public class SpooledFileOutputStream
extends java.io.OutputStream
Constructor and Description |
---|
SpooledFileOutputStream(AS400 system,
PrintParameterList options,
PrinterFile printerFile,
OutputQueue outputQueue)
Constructs a SpooledFileOutputStream object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the stream.
|
SpooledFile |
getSpooledFile()
Returns the spooled file that was created (or is being created) with
this output stream.
|
void |
write(byte[] data)
Writes data.length bytes of data from the byte array
data to the spooled file.
|
void |
write(byte[] data,
int offset,
int length)
Writes up to length bytes of data from the byte array data,
starting at offset, to this spooled file.
|
void |
write(int b)
Writes a byte of data.
|
public SpooledFileOutputStream(AS400 system, PrintParameterList options, PrinterFile printerFile, OutputQueue outputQueue) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException
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:
printerFile
- Optional. The printer file that should be used
to create the spooled file. This printer file
must reside on the same system that the
spooled file is being created on.outputQueue
- Optional. The output queue on which to create the
spooled file. The output queue must reside on
the same system that the spooled file
is being created on.AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.java.lang.InterruptedException
- If this thread is interrupted.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
- If an error occurs while communicating with the system.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- If an error occurs while communicating with the system.public SpooledFile getSpooledFile() throws java.io.IOException
java.io.IOException
- If an error occurs while communicating with the system.public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- The byte to be written.java.io.IOException
- If an error occurs while communicating with the system.public void write(byte[] data) throws java.io.IOException
write
in class java.io.OutputStream
data
- The data to be written.java.io.IOException
- If an error occurs while communicating with the system.public void write(byte[] data, int offset, int length) throws java.io.IOException
write
in class java.io.OutputStream
data
- The data to be written.offset
- The start offset in the data.length
- The number of bytes that are written.java.io.IOException
- If an error occurs while communicating with the system.