public class FastInputStream
extends java.io.InputStream
This class extends InputStream and its read()
methods allow it to be used as a standard input stream. In addition, it
provides readFast() methods that are not declared to throw
IOException. IOException is never thrown by this
class.
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buf |
protected int |
len |
protected int |
mark |
protected int |
off |
| Constructor and Description |
|---|
FastInputStream(byte[] buffer)
Creates an input stream.
|
FastInputStream(byte[] buffer,
int offset,
int length)
Creates an input stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
byte[] |
getBufferBytes()
Returns the underlying data being read.
|
int |
getBufferLength()
Returns the end of the buffer being read.
|
int |
getBufferOffset()
Returns the offset at which data is being read from the buffer.
|
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] toBuf) |
int |
read(byte[] toBuf,
int offset,
int length) |
int |
readFast()
Equivalent to
read() |
int |
readFast(byte[] toBuf)
Equivalent to
read(byte[]) |
int |
readFast(byte[] toBuf,
int offset,
int length)
Equivalent to
read(byte[],int,int) |
void |
reset() |
long |
skip(long count) |
void |
skipFast(int count)
Equivalent to
skip() |
protected int len
protected int off
protected int mark
protected byte[] buf
public FastInputStream(byte[] buffer)
buffer - the data to read.public FastInputStream(byte[] buffer,
int offset,
int length)
buffer - the data to read.offset - the byte offset at which to begin reading.length - the number of bytes to read.public int available()
available in class java.io.InputStreampublic boolean markSupported()
markSupported in class java.io.InputStreampublic void mark(int readLimit)
mark in class java.io.InputStreampublic void reset()
reset in class java.io.InputStreampublic long skip(long count)
skip in class java.io.InputStreampublic int read()
read in class java.io.InputStreampublic int read(byte[] toBuf)
read in class java.io.InputStreampublic int read(byte[] toBuf,
int offset,
int length)
read in class java.io.InputStreampublic final void skipFast(int count)
skip() but takes an int parameter instead of a
long, and does not check whether the count given is larger than the
number of remaining bytes.skip(long)public final int readFast()
read() but does not throw
IOException.read()public final int readFast(byte[] toBuf)
read(byte[]) but does not throw
IOException.read(byte[])public final int readFast(byte[] toBuf,
int offset,
int length)
read(byte[],int,int) but does not throw
IOException.read(byte[],int,int)public final byte[] getBufferBytes()
public final int getBufferOffset()
public final int getBufferLength()
Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.