Package com.adobe.internal.io.stream
Interface InputByteStream
-
- All Known Implementing Classes:
CroppedImageInputByteStream
,InputByteStreamImpl
,PaddedInputByteStream
,RangeInputByteStream
public interface InputByteStream
-
-
Field Summary
Fields Modifier and Type Field Description static int
EOF
Only for internal engineering use.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
bytesAvailable()
Only for internal engineering use.void
close()
Closes this InputByteStream and releases any system resources associated with the stream.boolean
eof()
Only for internal engineering use.long
getPosition()
Only for internal engineering use.long
length()
Only for internal engineering use.int
read()
Only for internal engineering use.int
read(byte[] bytes)
Only for internal engineering use.int
read(byte[] bytes, int position, int length)
Only for internal engineering use.InputByteStream
seek(long position)
Only for internal engineering use.InputByteStream
slice()
Only for internal engineering use.InputByteStream
slice(long begin, long length)
Only for internal engineering use.java.io.InputStream
toInputStream()
Create an InputStream that represents the same data as this InputByteStream.int
unget()
Only for internal engineering use.
-
-
-
Field Detail
-
EOF
static final int EOF
Only for internal engineering use. This api can change without notice. The value is returned as a marker for the End Of File from the get() methods.- See Also:
- Constant Field Values
-
-
Method Detail
-
slice
InputByteStream slice(long begin, long length) throws java.io.IOException
Only for internal engineering use. This api can change without notice. Create a newInputByteStream
that that provides another view on the underlying data. This newInputByteStream
is completely independent and can be read from and positioned without affecting the original or any other sliceInputByteStream
objects. The initial position of the slice is at zero - the beginning of the slice.- Parameters:
begin
- Offset within the currentInputByteStream
to start the slice.length
- The length of the slice.- Returns:
- A slice of the original
InputByteStream
. - Throws:
java.io.IOException
-
slice
InputByteStream slice() throws java.io.IOException
Only for internal engineering use. This api can change without notice. Create a newInputByteStream
that that provides another view on the underlying data. This newInputByteStream
is completely independent and can be read from and positioned without affecting the original or any other sliceInputByteStream
objects. The initial position of the slice is at zero - the beginning of the slice. The slice has the same bounds as the originalInputByteStream
. One common but probably incorrect usage of this method is to create a temporary "view" on the data that is used briefly within a method and then discarded. This is pretty wasteful and creates a number of small objects. In that case it would be better to find the current position usinggetPosition()
and store it locally in the method and then restore the position withsetPosition()
before returning from the method.- Returns:
- A slice of the original
InputByteStream
. - Throws:
java.io.IOException
-
read
int read() throws java.io.IOException
Only for internal engineering use. This api can change without notice. Read the byte at the current position. If the current position is at or beyond the end of the underlying data return a-1
. If not beyond the end of the underlying data the current position is incremented by 1.- Returns:
- The byte at the current position or
-1
if at or beyond EOF. - Throws:
java.io.IOException
-
read
int read(byte[] bytes, int position, int length) throws java.io.IOException
Only for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.- Parameters:
bytes
- The destination array.position
- The offset in the byte array to put the first byte read.length
- The number of bytes to read.- Throws:
java.io.IOException
-
read
int read(byte[] bytes) throws java.io.IOException
Only for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.- Parameters:
bytes
- The destination array.- Throws:
java.io.IOException
-
unget
int unget() throws java.io.IOException
Only for internal engineering use. This api can change without notice. "Unget" the byte from underlying data. This essentially returns the byte just before the current position and sets the current position to point at that byte (one before the current position).- Throws:
java.io.IOException
-
seek
InputByteStream seek(long position) throws java.io.IOException
Only for internal engineering use. This api can change without notice. Set the current position in the underlying data. This position is pegged to be no less than zero and no greater than the length of the InputByteStream.- Parameters:
position
- Where to set the current position.- Returns:
- This object.
- Throws:
java.io.IOException
-
getPosition
long getPosition() throws java.io.IOException
Only for internal engineering use. This api can change without notice. Get the current position.- Returns:
- The current position.
- Throws:
java.io.IOException
-
length
long length() throws java.io.IOException
Only for internal engineering use. This api can change without notice. The maximum number of bytes that can be read from thisInputByteStream
.- Returns:
- Total number of bytes available in this
InputByteStream
. - Throws:
java.io.IOException
-
bytesAvailable
long bytesAvailable() throws java.io.IOException
Only for internal engineering use. This api can change without notice. The number of bytes available to be read from the current position.- Returns:
- Number of bytes available from the current position in this
InputByteStream
. - Throws:
java.io.IOException
-
eof
boolean eof() throws java.io.IOException
Only for internal engineering use. This api can change without notice. Is the current position of thisInputByteStream
at or beyond the end of the underlying data.- Returns:
- True if the current position is beyond the end of the underlying data, false otherwise.
- Throws:
java.io.IOException
-
close
void close() throws java.io.IOException
Closes this InputByteStream and releases any system resources associated with the stream. After this method is called then any further calls to this instance are errors.- Throws:
java.io.IOException
-
toInputStream
java.io.InputStream toInputStream() throws java.io.IOException
Create an InputStream that represents the same data as this InputByteStream. The new InputStream is independent of the InputByteStream and operations on one will not affect the other including closing of either stream.- Returns:
- an InputStream that refers to the same underlying data
- Throws:
java.io.IOException
-
-