Package ghidra.app.util.bin
Class ByteProviderInputStream
- java.lang.Object
-
- java.io.InputStream
-
- ghidra.app.util.bin.ByteProviderInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
ByteProviderInputStream.ClosingInputStream
public class ByteProviderInputStream extends java.io.InputStream
AnInputStream
that reads from aByteProvider
.Does not close the underlying ByteProvider when closed itself.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ByteProviderInputStream.ClosingInputStream
AnInputStream
that reads from aByteProvider
, and DOESclose()
the underlying ByteProvider when closed itself.
-
Field Summary
Fields Modifier and Type Field Description protected ByteProvider
provider
-
Constructor Summary
Constructors Constructor Description ByteProviderInputStream(ByteProvider provider)
Creates an InputStream that uses a ByteProvider as its source of bytes.ByteProviderInputStream(ByteProvider provider, long startPosition)
Creates an InputStream that uses a ByteProvider as its source of bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b, int bufferOffset, int len)
void
reset()
long
skip(long n)
-
-
-
Field Detail
-
provider
protected ByteProvider provider
-
-
Constructor Detail
-
ByteProviderInputStream
public ByteProviderInputStream(ByteProvider provider)
Creates an InputStream that uses a ByteProvider as its source of bytes.- Parameters:
provider
- theByteProvider
to wrap
-
ByteProviderInputStream
public ByteProviderInputStream(ByteProvider provider, long startPosition)
Creates an InputStream that uses a ByteProvider as its source of bytes.- Parameters:
provider
- theByteProvider
to wrapstartPosition
- starting position in the provider
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int bufferOffset, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-