public class PrintObjectPageInputStream
extends java.io.InputStream
The number of pages in the spooled file may be estimated. To help process spooled files with estimated page counts, methods nextPage, previousPage, and selectPage will return false if the requested page is not available.
An instance of this class is created using the getPageInputStream method from the class SpooledFile.
NOTE: This class is supported on OS/400 V4R4 or later. Not all spooled file formats are supported for transform.
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns the number of bytes remaining in the current page.
|
void |
close()
Closes the input stream and releases any resources associated with it.
|
int |
getCurrentPageNumber()
Returns the number of the current page of the input stream.
|
int |
getNumberOfPages()
Returns the number of pages in the stream.
|
boolean |
isPagesEstimated()
Indicates if the number of pages is estimated.
|
void |
mark(int readLimit)
Marks the current position of the current page of the input stream.
|
boolean |
markSupported()
Returns a boolean indicating whether this stream type supports mark and reset.
|
boolean |
nextPage()
Repositions the stream to the next page.
|
boolean |
previousPage()
Repositions the stream to the previous page.
|
int |
read()
Reads the next byte of data from this input stream.
|
int |
read(byte[] data)
Reads up to data.length bytes of data from the page input
stream into data.
|
int |
read(byte[] data,
int dataOffset,
int length)
Reads up to length bytes of data from this input stream into data,
starting at the array offset dataOffset.
|
void |
reset()
Repositions the stream to the last marked position.
|
boolean |
selectPage(int page)
Repositions the stream to page page.
|
long |
skip(long bytesToSkip)
Skips over the next bytesToSkip bytes in the stream.
|
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- If an error occurs while communicating with the system.public int getCurrentPageNumber()
public int getNumberOfPages()
public boolean isPagesEstimated()
public void mark(int readLimit)
mark
in class java.io.InputStream
readLimit
- The maximum limit of bytes allowed to be read before
the mark position is no longer valid.public boolean markSupported()
markSupported
in class java.io.InputStream
public boolean nextPage() throws java.io.IOException
java.io.IOException
- If an error occurs while communicating with the system.public boolean previousPage() throws java.io.IOException
java.io.IOException
- If an error occurs while communicating with the system.public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- If an error occurs while communicating with the system.public int read(byte[] data) throws java.io.IOException
read
in class java.io.InputStream
data
- The buffer into which the data is read.java.io.IOException
- If an error occurs while communicating with the system.public int read(byte[] data, int dataOffset, int length) throws java.io.IOException
read
in class java.io.InputStream
data
- The buffer into which the data is read.dataOffset
- The start offset of the data.length
- The maximum number of bytes to read.java.io.IOException
- If an error occurs while communicating with the system.public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
- If an error occurs while communicating with the system.public boolean selectPage(int page) throws java.io.IOException, java.lang.IllegalArgumentException
page
- The page at which to reposition the input stream.java.io.IOException
- If an error occurs while communicating with the system,
or an error occurs selecting the specified page.java.lang.IllegalArgumentException
- If page is negative.public long skip(long bytesToSkip) throws java.io.IOException
skip
in class java.io.InputStream
bytesToSkip
- The number of bytes to be skipped.java.io.IOException
- If an error occurs while communicating with the system.