DocumentDescriptionpublic class DocumentDescription extends Object implements Serializable, PrinterConstants
Fields Summary |
---|
private transient InputStream | _actualDocument | private int | _length | private int | _documentType | private boolean | _printTwoSided | private int | _printQuality |
Constructors Summary |
---|
public DocumentDescription(InputStream actualDocument)
this (actualDocument, DEFAULT_DOCUMENT_TYPE, DEFAULT_PRINT_TWO_SIDED,
DEFAULT_PRINT_QUALITY);
| public DocumentDescription(InputStream actualDocument, int documentType, boolean printTwoSided, int printQuality)
_documentType = documentType;
_printTwoSided = printTwoSided;
_printQuality = printQuality;
BufferedInputStream buffer = new BufferedInputStream(actualDocument);
DataInputStream dataInputStream = new DataInputStream(buffer);
ByteArrayOutputStream temporaryBuffer = new ByteArrayOutputStream();
_length = copy(dataInputStream, new DataOutputStream(temporaryBuffer));
_actualDocument = new DataInputStream(new ByteArrayInputStream(temporaryBuffer.toByteArray()));
|
Methods Summary |
---|
private int | copy(java.io.InputStream source, java.io.OutputStream destination)
int nextByte;
int numberOfBytesCopied = 0;
while (-1 != (nextByte = source.read())) {
destination.write(nextByte);
numberOfBytesCopied++;
}
destination.flush();
return numberOfBytesCopied;
| private void | copy(java.io.InputStream source, java.io.OutputStream destination, int length)
int counter;
int nextByte;
for (counter = 0; counter < length; counter++) {
nextByte = source.read();
destination.write(nextByte);
}
destination.flush();
| public int | getDocumentType()
return _documentType;
| public int | getPrintQuality()
return _printQuality;
| public boolean | isPrintTwoSided()
return _printTwoSided;
| private void | readObject(java.io.ObjectInputStream in)
in.defaultReadObject();
ByteArrayOutputStream temporaryBuffer = new ByteArrayOutputStream();
copy(in, temporaryBuffer, _length);
_actualDocument = new DataInputStream(new ByteArrayInputStream(temporaryBuffer.toByteArray()));
| private void | writeObject(java.io.ObjectOutputStream out)
out.defaultWriteObject();
copy(_actualDocument, out);
|
|