public abstract class StreamInput extends InputStream
This class's methods are optimized so you can put the methods that read and write a class next to each other and you can scan them
visually for differences. That means that most variables should be read and written in a single line so even large objects fit both
reading and writing on the screen. It also means that the methods on this class are named very similarly to StreamOutput. Finally
it means that the "barrier to entry" for adding new methods to this class is relatively low even though it is a shared class with code
everywhere. That being said, this class deals primarily with Lists rather than Arrays. For the most part calls should adapt to
lists, either by storing Lists internally or just converting to and from a List when calling. This comment is repeated
on StreamInput.
| 构造器和说明 |
|---|
StreamInput() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract int |
available() |
abstract void |
close()
Closes the stream to further operations.
|
boolean |
readBoolean()
Reads a boolean.
|
abstract byte |
readByte()
Reads and returns a single byte.
|
abstract void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset.
|
double |
readDouble() |
float |
readFloat() |
Object |
readGenericValue()
Reads a value of unspecified type.
|
int |
readInt()
Reads four bytes and returns an int.
|
long |
readLong()
Reads eight bytes and returns a long.
|
Boolean |
readOptionalBoolean() |
Double |
readOptionalDouble() |
Float |
readOptionalFloat() |
Integer |
readOptionalInt()
Reads an optional
Integer. |
Long |
readOptionalLong() |
Integer |
readOptionalVInt() |
Long |
readOptionalVLong() |
short |
readShort() |
int |
readVInt()
Reads an int stored in variable-length format.
|
long |
readVLong()
Reads a long stored in variable-length format.
|
long |
readZLong() |
static StreamInput |
wrap(byte[] bytes) |
static StreamInput |
wrap(byte[] bytes,
int offset,
int length) |
mark, markSupported, read, read, read, reset, skippublic static StreamInput wrap(byte[] bytes)
public static StreamInput wrap(byte[] bytes, int offset, int length)
public abstract void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 InputStreamIOExceptionpublic abstract int available()
throws IOException
available 在类中 InputStreamIOExceptionpublic abstract byte readByte()
throws IOException
IOExceptionpublic abstract void readBytes(byte[] b,
int offset,
int len)
throws IOException
b - the array to read bytes intooffset - the offset in the array to start storing byteslen - the number of bytes to readIOExceptionpublic short readShort()
throws IOException
IOExceptionpublic int readInt()
throws IOException
IOExceptionpublic Integer readOptionalInt() throws IOException
Integer.IOExceptionpublic int readVInt()
throws IOException
readInt()IOExceptionpublic Integer readOptionalVInt() throws IOException
IOExceptionpublic long readLong()
throws IOException
IOExceptionpublic Long readOptionalLong() throws IOException
IOExceptionpublic long readVLong()
throws IOException
readLong() or readZLong() for negative numbers.IOExceptionpublic Long readOptionalVLong() throws IOException
IOExceptionpublic long readZLong()
throws IOException
IOExceptionpublic final float readFloat()
throws IOException
IOExceptionpublic Float readOptionalFloat() throws IOException
IOExceptionpublic final double readDouble()
throws IOException
IOExceptionpublic final Double readOptionalDouble() throws IOException
IOExceptionpublic final boolean readBoolean()
throws IOException
IOExceptionpublic final Boolean readOptionalBoolean() throws IOException
IOExceptionpublic Object readGenericValue() throws IOException
IOExceptionCopyright © 2021. All rights reserved.