类 ConfinedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.mysql.cj.protocol.x.ConfinedInputStream
-
- 所有已实现的接口:
Closeable,AutoCloseable
public class ConfinedInputStream extends FilterInputStream
AnInputStreamwrapper that limits the number of bytes that can be read form the underlyingInputStream.
-
-
字段概要
-
从类继承的字段 java.io.FilterInputStream
in
-
-
构造器概要
构造器 限定符 构造器 说明 protectedConfinedInputStream(InputStream in)protectedConfinedInputStream(InputStream in, int lim)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 intavailable()Returns the number of bytes not yet consumed.voidclose()Closes this stream and throws away any bytes not consumed from the underlyingInputStream.protected longdumpLeftovers()Skips the number bytes not yet consumed from the underlyingInputStream.intread()intread(byte[] b)Forwards the read toread(byte[], int, int).intread(byte[] b, int off, int len)Reads bytes from the underlyingInputStreamup to the number of bytes defined in thisConfinedInputStreamlimit.intresetLimit(int len)Resets thisConfinedInputStreamlimit so that it can be reused over the same underlyingInputStream.-
从类继承的方法 java.io.FilterInputStream
mark, markSupported, reset, skip
-
从类继承的方法 java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
构造器详细资料
-
ConfinedInputStream
protected ConfinedInputStream(InputStream in)
-
ConfinedInputStream
protected ConfinedInputStream(InputStream in, int lim)
-
-
方法详细资料
-
available
public int available() throws IOExceptionReturns the number of bytes not yet consumed. Note that this method doen't care about the exact number of bytes that may or may not be available in the underlyingInputStream- 覆盖:
available在类中FilterInputStream- 返回:
- the number of bytes available.
- 抛出:
IOException- 另请参阅:
FilterInputStream.available()
-
close
public void close() throws IOExceptionCloses this stream and throws away any bytes not consumed from the underlyingInputStream.- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 覆盖:
close在类中FilterInputStream- 抛出:
IOException- 另请参阅:
FilterInputStream.close()
-
read
public int read() throws IOException- 覆盖:
read在类中FilterInputStream- 抛出:
IOException- 另请参阅:
FilterInputStream.read()
-
read
public int read(byte[] b) throws IOExceptionForwards the read toread(byte[], int, int).- 覆盖:
read在类中FilterInputStream- 抛出:
IOException- 另请参阅:
FilterInputStream.read(byte[])
-
read
public int read(byte[] b, int off, int len) throws IOExceptionReads bytes from the underlyingInputStreamup to the number of bytes defined in thisConfinedInputStreamlimit.- 覆盖:
read在类中FilterInputStream- 抛出:
IOException- 另请参阅:
FilterInputStream.read(byte[], int, int)
-
resetLimit
public int resetLimit(int len)
Resets thisConfinedInputStreamlimit so that it can be reused over the same underlyingInputStream.- 参数:
len- the new length to set.- 返回:
- the number of bytes not consumed before reseting the limit.
-
dumpLeftovers
protected long dumpLeftovers() throws IOExceptionSkips the number bytes not yet consumed from the underlyingInputStream.- 返回:
- the number of bytes skipped.
- 抛出:
IOException- if any of the underlying I/O operations fail.
-
-