Methods Summary |
---|
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();
|
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;
|
public int | getDocumentType()
return _documentType;
|
public int | getLength()
return _length;
|
public int | getPrintQuality()
return _printQuality;
|
public boolean | isPrintTwoSided()
return _printTwoSided;
|
public void | readFromStream(java.io.InputStream inputStream)
BufferedInputStream buffer = new BufferedInputStream(inputStream);
DataInputStream dataInputStream = new DataInputStream(buffer);
readMetadataFromStream(dataInputStream);
ByteArrayOutputStream temporaryBuffer = new ByteArrayOutputStream();
copy(dataInputStream, new DataOutputStream(temporaryBuffer), _length);
_actualDocument = new DataInputStream(new ByteArrayInputStream(temporaryBuffer.toByteArray()));
|
private void | readMetadataFromStream(java.io.DataInputStream dataInputStream)
_documentType = dataInputStream.readInt();
_printTwoSided = dataInputStream.readBoolean();
_printQuality = dataInputStream.readInt();
_length = dataInputStream.readInt();
|
private void | writeMetadataToStream(java.io.DataOutputStream dataOutputStream)
dataOutputStream.writeInt(_documentType);
dataOutputStream.writeBoolean(_printTwoSided);
dataOutputStream.writeInt(_printQuality);
dataOutputStream.writeInt(_length);
|
public void | writeToStream(java.io.OutputStream outputStream)
BufferedOutputStream buffer = new BufferedOutputStream(outputStream);
DataOutputStream dataOutputStream = new DataOutputStream(buffer);
writeMetadataToStream(dataOutputStream);
copy(_actualDocument, dataOutputStream, _length);
|