Package com.adobe.internal.io.stream
Class PaddedInputByteStream
java.lang.Object
com.adobe.internal.io.stream.InputByteStreamImpl
com.adobe.internal.io.stream.PaddedInputByteStream
- All Implemented Interfaces:
InputByteStream
Only for internal engineering use. This api can change without notice.
This class provides access to a seekable input stream with support of padding without allocating any extra memory. This class's
object wraps inside it an InputByteStream. It extends the
InputByteStreamImpl abstract class.-
Field Summary
Fields inherited from interface com.adobe.internal.io.stream.InputByteStream
EOF -
Constructor Summary
ConstructorsConstructorDescriptionPaddedInputByteStream(InputByteStream ibs, int paddedChar, long padLength) constructor with InputByteStream, character to be padded and padding length as parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this InputByteStream and releases any system resources associated with the stream.longGet the current position.longlength()The maximum number of bytes that can be read from thisInputByteStream.intread()Read the byte at the current position.intread(byte[] bytes, int position, int length) Read an array of bytes starting at the current position.seek(long position) Set the current position in the underlying data.slice(long begin, long length) Create a newInputByteStreamthat provides another view on the underlying data.Methods inherited from class com.adobe.internal.io.stream.InputByteStreamImpl
bytesAvailable, eof, read, slice, toInputStream, toString, unget
-
Constructor Details
-
PaddedInputByteStream
constructor with InputByteStream, character to be padded and padding length as parameters.- Parameters:
ibs-paddedChar-padLength-
-
-
Method Details
-
close
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.- Specified by:
closein interfaceInputByteStream- Specified by:
closein classInputByteStreamImpl- Throws:
IOException
-
getPosition
Get the current position.- Specified by:
getPositionin interfaceInputByteStream- Specified by:
getPositionin classInputByteStreamImpl- Returns:
- The current position.
- Throws:
IOException
-
length
The maximum number of bytes that can be read from thisInputByteStream.- Specified by:
lengthin interfaceInputByteStream- Specified by:
lengthin classInputByteStreamImpl- Returns:
- Total number of bytes available in this
InputByteStream. - Throws:
IOException
-
read
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.- Specified by:
readin interfaceInputByteStream- Specified by:
readin classInputByteStreamImpl- Returns:
- The byte at the current position or
-1if at or beyond EOF. - Throws:
IOException
-
read
Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.- Specified by:
readin interfaceInputByteStream- Specified by:
readin classInputByteStreamImpl- 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:
IOException
-
seek
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.- Specified by:
seekin interfaceInputByteStream- Specified by:
seekin classInputByteStreamImpl- Parameters:
position- Where to set the current position.- Returns:
- This object.
- Throws:
IOException
-
slice
Create a newInputByteStreamthat provides another view on the underlying data. This newInputByteStreamis completely independent and can be read from and positioned without affecting the original or any other sliceInputByteStreamobjects. The initial position of the slice is at zero - the beginning of the slice.- Specified by:
slicein interfaceInputByteStream- Specified by:
slicein classInputByteStreamImpl- Parameters:
begin- Offset within the currentInputByteStreamto start the slice.length- The length of the slice.- Returns:
- A slice of the original
InputByteStream. - Throws:
IOException
-