Reading spooled files using PrintObjectPageInputStream and PrintObjectTransformedInputStream

You can use the PrintObjectPageInputStream class to read the data out of a server AFP and SCS spooled file one page at a time.

You can obtain a PrintObjectPageInputStream object with the getPageInputStream() method.

Use one of the read() methods for reading from the input stream. All these methods return the number of bytes actually read, or -1 if no bytes were read and the end of page was reached.

Use the available() method of PrintObjectPageInputStream to return the total number of bytes in the current page. The PrintObjectPageInputStream class supports marking the input stream, so PrintObjectPageInputStream always returns true from the markSupported() method. The caller can use the mark() and reset() methods to move the current read position backward in the input stream so that subsequent reads reread the same bytes. The caller can use the skip() method to move the read position forward in the input stream without reading the data.

However, when transforming an entire spooled file data stream is desired, use the PrintObjectTransformedInputStream class.

Example

The following example shows how to use PrintObjectPageInputStream and PrintObjectTransformedInputStream to obtain different transformations when reading spooled file data:

Example: Reading and transforming spooled files