java.lang.Object
java.io.InputStream
io.smallrye.common.resource.MemoryInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An input stream over a segment of memory.
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryInputStream(byte[] bytes) Construct a new instance for a byte array.MemoryInputStream(ByteBuffer buffer) Construct a new instance for a byte buffer. -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voidmark(int bytes) booleanintread()intread(byte[] b, int off, int len) byte[]voidreset()longskip(long n) longtransferTo(OutputStream out) Methods inherited from class java.io.InputStream
nullInputStream, read, readNBytes, readNBytes, skipNBytes
-
Constructor Details
-
MemoryInputStream
Construct a new instance for a byte buffer. The given buffer contents are not copied. Consuming the stream will not affect the buffer's position or limit. Modifying the buffer's position or limit will not affect operation of the stream.- Parameters:
buffer- the byte buffer containing the stream data (must not benull)
-
MemoryInputStream
public MemoryInputStream(byte[] bytes) Construct a new instance for a byte array. The byte array is not copied.- Parameters:
bytes- the byte array (must not benull)
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
readAllBytes
- Overrides:
readAllBytesin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
transferTo
- Overrides:
transferToin classInputStream- Throws:
IOException
-
mark
public void mark(int bytes) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
available
public int available()- Overrides:
availablein classInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-