net.sf.lpr.spi
Class AbstractPrint
java.lang.Object
net.sf.lpr.spi.AbstractPrint
- All Implemented Interfaces:
- LPR
- Direct Known Subclasses:
- LPRAsBerkeleyUnixPlot, LPRDitroff, LPRDVI, LPRFORTRAN, LPRLeavingControlCharacters, LPRPlainText, LPRPostscript
public abstract class AbstractPrint
- extends java.lang.Object
- implements LPR
Implements the LPR interface. Holds all the boiler plate code that would be duplicated throughout all the different print
requests. It uses a Socket to do the communication with the server. The server is assumed to be running the standard LPD port
of 515.
- Author:
- x_sid
|
Constructor Summary |
protected |
AbstractPrint(java.lang.String serverName,
java.lang.String username,
java.lang.String printQueue,
java.lang.String filename,
java.io.InputStream toPrint,
long toPrintLength)
Construct a call to the LPD server to send a file to the server |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractPrint
protected AbstractPrint(java.lang.String serverName,
java.lang.String username,
java.lang.String printQueue,
java.lang.String filename,
java.io.InputStream toPrint,
long toPrintLength)
- Construct a call to the LPD server to send a file to the server
- Parameters:
serverName - the name of the server that the print queue is running onusername - the name of the user that will be sent to the server as requesting the print requestprintQueue - the queue on the LPD server that the postscript file will be sent tofilename - this is a generic filename that will be used to identify the file. It is really just a simple identifier.toPrint - the InputStream that will be read and sent to the server to be printed. It is not closed by this class.toPrintLength - the length of the InputStream that is to be printed. This is needed because the spec needs to
know how long the actual file to be printed is when the control file is sent to the LPD server
getPrintJobType
protected abstract PrintType getPrintJobType()
print
public void print()
throws IORuntimeException,
UnknownHostRuntimeException
- Call print once the actual call to the LPD server needs to be made. The connection to the server is not made until this
method is called. Also once the method returns the connection to the server will be closed. Also the
InputStream passed
in through the constructor is not closed. It is up to the caller to close it.
- Specified by:
print in interface LPR
- Throws:
IORuntimeException
UnknownHostRuntimeException