Modifier and Type | Field and Description |
---|---|
protected long |
length |
Constructor and Description |
---|
InputStream() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a clone of this stream.
|
abstract void |
close()
Closes the stream to futher operations.
|
long |
getFilePointer()
Returns the current position in this file, where the next read will
occur.
|
long |
length()
The number of bytes in the file.
|
byte |
readByte()
Reads and returns a single byte.
|
void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset.
|
void |
readChars(char[] buffer,
int start,
int length)
Reads UTF-8 encoded characters into an array.
|
int |
readInt()
Reads four bytes and returns an int.
|
protected abstract void |
readInternal(byte[] b,
int offset,
int length)
Expert: implements buffer refill.
|
long |
readLong()
Reads eight bytes and returns a long.
|
String |
readString()
Reads a string.
|
int |
readVInt()
Reads an int stored in variable-length format.
|
long |
readVLong()
Reads a long stored in variable-length format.
|
void |
seek(long pos)
Sets current position in this file, where the next read will occur.
|
protected abstract void |
seekInternal(long pos)
Expert: implements seek.
|
public final byte readByte() throws IOException
IOException
OutputStream.writeByte(byte)
public final 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 readIOException
OutputStream.writeBytes(byte[],int)
public final int readInt() throws IOException
IOException
OutputStream.writeInt(int)
public final int readVInt() throws IOException
IOException
OutputStream.writeVInt(int)
public final long readLong() throws IOException
IOException
OutputStream.writeLong(long)
public final long readVLong() throws IOException
IOException
public final String readString() throws IOException
IOException
OutputStream.writeString(String)
public final void readChars(char[] buffer, int start, int length) throws IOException
buffer
- the array to read characters intostart
- the offset in the array to start storing characterslength
- the number of characters to readIOException
OutputStream.writeChars(String,int,int)
protected abstract void readInternal(byte[] b, int offset, int length) throws IOException
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslength
- the number of bytes to readIOException
public abstract void close() throws IOException
IOException
public final long getFilePointer()
seek(long)
public final void seek(long pos) throws IOException
IOException
getFilePointer()
protected abstract void seekInternal(long pos) throws IOException
readInternal(byte[],int,int)
will occur.IOException
readInternal(byte[],int,int)
public final long length()
public Object clone()
Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.
Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.
Copyright © 2024 GATE. All rights reserved.