Class InputStreamOrByteBufferAdapter
- java.lang.Object
-
- io.github.lukehutch.fastclasspathscanner.utils.InputStreamOrByteBufferAdapter
-
public abstract class InputStreamOrByteBufferAdapter extends Object
Buffer class that can wrap either an InputStream or a ByteBuffer, depending on which is available.
-
-
Constructor Summary
Constructors Constructor Description InputStreamOrByteBufferAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static InputStreamOrByteBufferAdaptercreate(InputStream inputStream)Create a new InputStream adapter.static InputStreamOrByteBufferAdaptercreate(ByteBuffer byteBuffer)Create a new ByteBuffer adapter.abstract intread(byte[] array, int off, int len)voidreadInitialChunk()intreadInt()Read an int from the buffer.intreadInt(int offset)Read an int from the buffer at a specific offset before the current read point.longreadLong()Read a long from the buffer.longreadLong(int offset)Read a long from the buffer at a specific offset before the current read point.StringreadString(int strStart, boolean replaceSlashWithDot, boolean stripLSemicolon)Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".intreadUnsignedByte()Read an unsigned byte from the buffer.intreadUnsignedByte(int offset)Read an unsigned byte from the buffer at a specific offset before the current read point.intreadUnsignedShort()Read an unsigned short from the buffer.intreadUnsignedShort(int offset)Read an unsigned short from the buffer at a specific offset before the current read point.voidskip(int bytesToSkip)Skip the given number of bytes in the input stream.
-
-
-
Method Detail
-
readInitialChunk
public void readInitialChunk() throws IOException- Throws:
IOException
-
readUnsignedByte
public int readUnsignedByte() throws IOException, InterruptedExceptionRead an unsigned byte from the buffer.- Throws:
IOExceptionInterruptedException
-
readUnsignedByte
public int readUnsignedByte(int offset)
Read an unsigned byte from the buffer at a specific offset before the current read point.
-
readUnsignedShort
public int readUnsignedShort() throws IOException, InterruptedExceptionRead an unsigned short from the buffer.- Throws:
IOExceptionInterruptedException
-
readUnsignedShort
public int readUnsignedShort(int offset)
Read an unsigned short from the buffer at a specific offset before the current read point.
-
readInt
public int readInt() throws IOException, InterruptedExceptionRead an int from the buffer.- Throws:
IOExceptionInterruptedException
-
readInt
public int readInt(int offset) throws IOExceptionRead an int from the buffer at a specific offset before the current read point.- Throws:
IOException
-
readLong
public long readLong() throws IOException, InterruptedExceptionRead a long from the buffer.- Throws:
IOExceptionInterruptedException
-
readLong
public long readLong(int offset) throws IOExceptionRead a long from the buffer at a specific offset before the current read point.- Throws:
IOException
-
skip
public void skip(int bytesToSkip) throws IOException, InterruptedExceptionSkip the given number of bytes in the input stream.- Throws:
IOExceptionInterruptedException
-
readString
public String readString(int strStart, boolean replaceSlashWithDot, boolean stripLSemicolon)
Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".
-
read
public abstract int read(byte[] array, int off, int len) throws IOException- Throws:
IOException
-
create
public static InputStreamOrByteBufferAdapter create(InputStream inputStream) throws IOException
Create a new InputStream adapter.- Throws:
IOException
-
create
public static InputStreamOrByteBufferAdapter create(ByteBuffer byteBuffer) throws IOException
Create a new ByteBuffer adapter.- Throws:
IOException
-
-