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
public class PaddedInputByteStream extends InputByteStreamImpl
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 theInputByteStreamImpl
abstract class.
-
-
Field Summary
-
Fields inherited from interface com.adobe.internal.io.stream.InputByteStream
EOF
-
-
Constructor Summary
Constructors Constructor Description PaddedInputByteStream(InputByteStream ibs, int paddedChar, long padLength)
constructor with InputByteStream, character to be padded and padding length as parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this InputByteStream and releases any system resources associated with the stream.long
getPosition()
Get the current position.long
length()
The maximum number of bytes that can be read from thisInputByteStream
.int
read()
Read the byte at the current position.int
read(byte[] bytes, int position, int length)
Read an array of bytes starting at the current position.InputByteStream
seek(long position)
Set the current position in the underlying data.InputByteStream
slice(long begin, long length)
Create a newInputByteStream
that 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 Detail
-
PaddedInputByteStream
public PaddedInputByteStream(InputByteStream ibs, int paddedChar, long padLength)
constructor with InputByteStream, character to be padded and padding length as parameters.- Parameters:
ibs
-paddedChar
-padLength
-
-
-
Method Detail
-
close
public 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.- Specified by:
close
in interfaceInputByteStream
- Specified by:
close
in classInputByteStreamImpl
- Throws:
java.io.IOException
-
getPosition
public long getPosition() throws java.io.IOException
Get the current position.- Specified by:
getPosition
in interfaceInputByteStream
- Specified by:
getPosition
in classInputByteStreamImpl
- Returns:
- The current position.
- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOException
The maximum number of bytes that can be read from thisInputByteStream
.- Specified by:
length
in interfaceInputByteStream
- Specified by:
length
in classInputByteStreamImpl
- Returns:
- Total number of bytes available in this
InputByteStream
. - Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
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:
read
in interfaceInputByteStream
- Specified by:
read
in classInputByteStreamImpl
- Returns:
- The byte at the current position or
-1
if at or beyond EOF. - Throws:
java.io.IOException
-
read
public int read(byte[] bytes, int position, int length) throws java.io.IOException
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:
read
in interfaceInputByteStream
- Specified by:
read
in 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:
java.io.IOException
-
seek
public InputByteStream seek(long position) throws java.io.IOException
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:
seek
in interfaceInputByteStream
- Specified by:
seek
in classInputByteStreamImpl
- Parameters:
position
- Where to set the current position.- Returns:
- This object.
- Throws:
java.io.IOException
-
slice
public InputByteStream slice(long begin, long length) throws java.io.IOException
Create a newInputByteStream
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.- Specified by:
slice
in interfaceInputByteStream
- Specified by:
slice
in classInputByteStreamImpl
- 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
-
-