All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.SpooledFile

java.lang.Object
   |
   +----com.ibm.as400.access.PrintObject
           |
           +----com.ibm.as400.access.SpooledFile

public class SpooledFile
extends PrintObject
implements Serializable
The SpooledFile class represents an AS/400 spooled file. You can use an instance of this class to manipulate an individual AS/400 spooled file (hold, release, delete, send, read, and so on). To create new spooled files on the AS/400, use the SpooledFileOutputStream class. See Spooled File Attributes for valid attributes.

See Also:
PrintObjectInputStream, PrintObjectPageInputStream, PrintObjectTransformedInputStream

Constructor Index

 o SpooledFile(AS400, String, int, String, String, String)
Constructs a SpooledFile object.

Method Index

 o answerMessage(String)
Replies to the message that caused the spooled file to wait.
 o delete()
Deletes the spooled file on the AS/400.
 o getInputStream()
Returns an input stream that can be used to read the contents of the spooled file.
 o getJobName()
Returns the name of the job that created the spooled file.
 o getJobNumber()
Returns the number of the job that created the spooled file.
 o getJobUser()
Returns the ID of the user that created the spooled file.
 o getMessage()
Returns the message that is associated with this spooled file.
 o getName()
Returns the name of the spooled file.
 o getNumber()
Returns the number of the spooled file.
 o getPageInputStream(PrintParameterList)
Returns a page input stream that can be used to read the contents of the spooled file, one page at a time.
 o getTransformedInputStream(PrintParameterList)
Returns a transformed input stream that can be used to read the contents of the spooled file.
 o hold(String)
Holds the spooled file.
 o move(OutputQueue)
Moves the spooled file to another output queue.
 o move(SpooledFile)
Moves the spooled file to another output queue or to another position on the same output queue.
 o moveToTop()
Moves the spooled file to the first position on the output queue.
 o release()
Releases a held spooled file on the AS/400.
 o sendNet(PrintParameterList)
Sends the spooled file to another user on the same system or to a remote system on the network.
 o sendTCP(PrintParameterList)
Sends a spooled file to be printed on a remote system.
 o setAttributes(PrintParameterList)
Sets one or more attributes of the object.

Constructors

 o SpooledFile
 public SpooledFile(AS400 system,
                    String name,
                    int number,
                    String jobName,
                    String jobUser,
                    String jobNumber)
Constructs a SpooledFile object. It uses the specified system and spooled file attributes that identify it on that system.

Parameters:
system - The system on which this spooled file exists.
name - The name of the spooled file.
number - The number of the spooled file.
jobName - The name of the job that created the spooled file.
jobUser - The user who created the spooled file.
jobNumber - The number of the job that created the spooled file.

Methods

 o answerMessage
 public void answerMessage(String reply) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Replies to the message that caused the spooled file to wait.

Parameters:
reply - The string that contains the reply for the message. The default reply can be obtained by calling the getMessage() method, and then calling the getDefaultReply() method on the message object that is returned. Other possible replies are given in the message help, which can also be retrieved from the message object returned on the getMessage() method.
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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o delete
 public void delete() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException
Deletes the spooled file on the AS/400.

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.
 o getInputStream
 public PrintObjectInputStream getInputStream() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Returns an input stream that can be used to read the contents of the spooled file. This method will fail with an AS400Exception if the spooled file is still being created (ATTR_SPLFSTATUS is *OPEN).

Returns:
The input stream object that can be used to read the contents of this 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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o getJobName
 public String getJobName()
Returns the name of the job that created the spooled file.

Returns:
The job name.
 o getJobNumber
 public String getJobNumber()
Returns the number of the job that created the spooled file.

Returns:
The job number.
 o getJobUser
 public String getJobUser()
Returns the ID of the user that created the spooled file.

Returns:
The user ID.
 o getMessage
 public AS400Message getMessage() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException
Returns the message that is associated with this spooled file. A spooled file has a message associated with it if its ATTR_SPLFSTATUS attribute returns *MESSAGE.

Returns:
The AS400Message object that contains the message text, type, severity, id, date, time, and default reply.
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.
 o getName
 public String getName()
Returns the name of the spooled file.

Returns:
The name of the spooled file.
 o getNumber
 public int getNumber()
Returns the number of the spooled file.

Returns:
The number of the spooled file.
 o getPageInputStream
 public PrintObjectPageInputStream getPageInputStream(PrintParameterList pageStreamOptions) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Returns a page input stream that can be used to read the contents of the spooled file, one page at a time.
See Example using PrintObjectPageInputStream

Parameters:
pageStreamOptions - A print parameter list that contains parameters for generating the page input stream.
The following attributes are optional:
  • ATTR_MFGTYPE - Specifies the manufacturer type and model.
  • ATTR_WORKSTATION_CUST_OBJECT - Specifies the integrated file system name of the workstation customization object to be used. The workstation customizing object associated with the manufacturer, type, and model is the default.
  • ATTR_PAPER_SOURCE_1 - Specifies the paper size of drawer 1.
  • ATTR_PAPER_SOURCE_2 - Specifies the paper size of drawer 2.
  • ATTR_VIEWING_FIDELITY - Specifies the fidelity used to process pages.
Returns:
A page input stream object that can be used to read the contents of this spooled file, one page at a time.
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, or the spooled file format is not supported.
Throws: IOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedException
If this thread is interrupted.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o getTransformedInputStream
 public PrintObjectTransformedInputStream getTransformedInputStream(PrintParameterList transformOptions) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Returns a transformed input stream that can be used to read the contents of the spooled file.
See Example using PrintObjectTransformedInputStream

Parameters:
transformOptions - A print parameter list that contains parameters for generating the transformed input stream.
The following attribute MUST be set:
  • ATTR_MFGTYPE - Specifies the manufacturer, type, and model.
The following attributes are optional:
  • ATTR_WORKSTATION_CUST_OBJECT - Specifies the integrated file system name of the workstation customization object to be used. The workstation customizing object associated with the manufacturer, type, and model is the default.
  • ATTR_PAPER_SOURCE_1 - Specifies the paper size of drawer 1.
  • ATTR_PAPER_SOURCE_2 - Specifies the paper size of drawer 2.
Returns:
The transformed input stream object that can be used to read the contents of the transformed 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, or the spooled file format is not supported.
Throws: IOException
If an error occurs while communicating with the AS/400.
Throws: InterruptedException
If this thread is interrupted.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o hold
 public void hold(String holdType) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Holds the spooled file.

Parameters:
holdType - When to hold the spooled file. May be any of the following values:
  • *IMMED - The spooled file is held immediately.
  • *PAGEEND - The spooled file is held at the end of the current page.
holdType may be null. If holdType is not specified, the default is *IMMED.
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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o move
 public void move(SpooledFile targetSpooledFile) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Moves the spooled file to another output queue or to another position on the same output queue.

Parameters:
targetSpooledFile - The spooled file to move this spooled file after. The targetSpooledFile and this spooled file must reside on the same AS/400.
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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o move
 public void move(OutputQueue targetOutputQueue) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Moves the spooled file to another output queue.

Parameters:
targetOutputQueue - The output queue to move the spooled file to. The spooled file will be moved to the first position on this output queue. The output queue and this spooled file must reside on the same AS/400.
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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o moveToTop
 public void moveToTop() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Moves the spooled file to the first position on the output queue.

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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o release
 public void release() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Releases a held spooled file on the AS/400.

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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.
 o sendNet
 public void sendNet(PrintParameterList sendOptions) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException
Sends the spooled file to another user on the same system or to a remote system on the network. The equivalent of the AS/400 Send Network Spooled File (SNDNETSPLF) command will be issued against the spooled file.

Parameters:
sendOptions - A print parameter list that contains the parameters for the send. The following attributes MUST be set:
  • ATTR_TOUSERID - Specifies the user ID to send the spooled file to.
  • ATTR_TOADDRESS - Specifies the remote system to send the spooled file to.
The following attributes are optional:
  • ATTR_DATAFORMAT - Specifies the data format in which to transmit the spooled file. May be either of *RCDDATA or *ALLDATA. *RCDDATA is the default.
  • ATTR_VMMVSCLASS - Specifies the VM/MVS SYSOUT class for distributions sent to a VM host system or to an MVS host system. May be A to Z or 0 to 9. A is the default.
  • ATTR_SENDPTY - Specifies the queueing priority used for this spooled file when it is being routed through a SNADS network. May be *NORMAL or *HIGH. *NORMAL is the default.
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.
 o sendTCP
 public void sendTCP(PrintParameterList sendOptions) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException
Sends a spooled file to be printed on a remote system. The equivalent of the AS/400 Send TCP/IP Spooled File (SNDTCPSPLF) command will be issued against the spooled file. This is the AS/400 version of the TCP/IP LPR command.

Parameters:
sendOptions - A print parameter list that contains the parameters for the send. The following attributes MUST be set:
  • ATTR_RMTSYSTEM - Specifies the remote system to which the print request will be sent. May be a remote system name or the special value *INTNETADR.
  • ATTR_RMTPRTQ - Specifies the name of the destination print queue.
The following attributes are optional:
  • ATTR_DELETESPLF - Specifies whether or not to delete the spooled file after it has been successfully sent. May be *NO or *YES. *NO is the default.
  • ATTR_DESTOPTION - Specifies a destination-dependant option. These options will be sent to the remote system with the spooled file.
  • ATTR_DESTINATION - Specifies the type of system to which the spooled file is being sent. When sending to other AS/400 systems, this value should be *AS/400. May also be *OTHER or *PSF/2. *OTHER is the default.
  • ATTR_INTERNETADDR - Specifies the Internet address of the receiving system.
  • ATTR_MFGTYPE - Specifies the manufacturer, type, and model when transforming print data from SCS or AFP to ASCII.
  • ATTR_SCS2ASCII - Specifies whether the print data is to be transformed to ASCII. May be *NO or *YES. *NO is the default.
  • ATTR_WSCUSTMOBJ - Specifies the name of the workstation customization object.
  • ATTR_WSCUSTMOBJL - Specifies the name of the workstation customization object library.
  • ATTR_SEPPAGE - Specifies whether to print the separator page. May be *NO or *YES. *YES is the default.
  • ATTR_USRDTATFMLIB - Specifies the name of the user data transform library.
  • ATTR_USRDTATFM - Specifies the name of the user data transform.
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.
 o setAttributes
 public void setAttributes(PrintParameterList attributes) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, RequestNotSupportedException
Sets one or more attributes of the object. See Spooled File Attributes for a list of valid attributes that can be changed.

Parameters:
attributes - A print parameter list that contains the attributes to be changed.
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.
Throws: RequestNotSupportedException
If the requested function is not supported because the AS/400 system is not at the correct level.

All Packages  Class Hierarchy  This Package  Previous  Next  Index