Package ghidra.app.util.bin
Class ByteProviderPaddedInputStream
java.lang.Object
java.io.InputStream
ghidra.app.util.bin.ByteProviderPaddedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Wraps a
ByteProvider
and presents it as an InputStream
.
This InputStream will be limited to a region of the underlying ByteProvider, and has an optional amount of padding at the end of the stream where the stream will appear to have bytes with a value of zero.
-
Constructor Summary
ConstructorDescriptionByteProviderPaddedInputStream
(ByteProvider provider, long startOffset, long length, long padCount) Create a newByteProviderInputStream
instance, using the specifiedByteProvider
as the source of the bytes returned from this stream. -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
ByteProviderPaddedInputStream
public ByteProviderPaddedInputStream(ByteProvider provider, long startOffset, long length, long padCount) Create a newByteProviderInputStream
instance, using the specifiedByteProvider
as the source of the bytes returned from this stream.The source ByteProvider is not closed when this stream is closed.
The total number of bytes that can be read from this instance will be length + padCount.
- Parameters:
provider
- theByteProvider
to wrap.startOffset
- the starting offset in the ByteProvider.length
- the number of bytes from theByteProvider
to allow to be read by this InputStream.padCount
- the number of fake zero bytes to add after the reallength
bytes.
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
available
public int available()- Overrides:
available
in classInputStream
-