net.sf.lpr.daemon.subcommands
Class ReceiveDataFile

java.lang.Object
  extended by net.sf.lpr.daemon.subcommands.ReceiveDataFile
All Implemented Interfaces:
DaemonCommand

public class ReceiveDataFile
extends java.lang.Object
implements DaemonCommand

Class for formatting the message the data that will be sent to the LPD server. This class is responsible for sending the actual data file that is to be printed by the LPD server. This class must be called after the LPD server has been put into Receive Job mode. RFC 1179 says that the server should not care what order the Data file and Control file are sent in.

Author:
x_sid

Constructor Summary
ReceiveDataFile(java.io.PrintStream print, java.io.InputStream serverIn, java.lang.String serverName, int jobID, java.io.InputStream data, long dataLength)
          Construct the message to be sent to the LPD server that contains the data to be be print
 
Method Summary
 void print()
          writes the data file to the provided in the constructor with the PrintStream print argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceiveDataFile

public ReceiveDataFile(java.io.PrintStream print,
                       java.io.InputStream serverIn,
                       java.lang.String serverName,
                       int jobID,
                       java.io.InputStream data,
                       long dataLength)
Construct the message to be sent to the LPD server that contains the data to be be print

Parameters:
print - the PrintStream that the data will be written to for printing
serverIn - the stream that is read for the response
serverName - the name of the LPD server that the data file is to be written to. This is a required part of the message per RFC 1179
jobID - a job id that will be passed to the server. It needs to be at most 3 digits in length and greater than zero.
data - the stream that is to be read and sent to be printed.
dataLength - length of the data parameter.
Method Detail

print

public void print()
           throws IORuntimeException
writes the data file to the provided in the constructor with the PrintStream print argument

Specified by:
print in interface DaemonCommand
Throws:
IORuntimeException - when an error occurs writing, reading, or the server returns an unexpected response.