Class ThrottledFetcher.ThrottledInputstream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.manifoldcf.crawler.connectors.webcrawler.ThrottledFetcher.ThrottledInputstream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- ThrottledFetcher
protected static class ThrottledFetcher.ThrottledInputstream extends java.io.InputStreamThis class throttles an input stream based on the specified byte rate parameters. The throttling takes place across all streams that are open to the server in question.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.InputStreaminputStreamThe stream we are wrapping.protected org.apache.manifoldcf.connectorcommon.interfaces.IStreamThrottlerstreamThrottlerStream throttlerprotected ThrottledFetcher.ThrottledConnectionthrottledConnectionThe throttled connection we belong to
-
Constructor Summary
Constructors Constructor Description ThrottledInputstream(org.apache.manifoldcf.connectorcommon.interfaces.IStreamThrottler streamThrottler, ThrottledFetcher.ThrottledConnection connection, java.io.InputStream is)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Get available.protected intbasicRead(byte[] b, int off, int len, int totalSoFar)Basic read, which uses the server object to throttle activity.voidclose()Close.voidmark(int readLimit)Mark.booleanmarkSupported()Check if mark is supported.intread()Read a byte.intread(byte[] b)Read lots of bytes.intread(byte[] b, int off, int len)Read lots of specific bytes.voidreset()Reset.longskip(long n)Skip
-
-
-
Field Detail
-
streamThrottler
protected final org.apache.manifoldcf.connectorcommon.interfaces.IStreamThrottler streamThrottler
Stream throttler
-
throttledConnection
protected final ThrottledFetcher.ThrottledConnection throttledConnection
The throttled connection we belong to
-
inputStream
protected final java.io.InputStream inputStream
The stream we are wrapping.
-
-
Constructor Detail
-
ThrottledInputstream
public ThrottledInputstream(org.apache.manifoldcf.connectorcommon.interfaces.IStreamThrottler streamThrottler, ThrottledFetcher.ThrottledConnection connection, java.io.InputStream is)Constructor.
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionRead a byte.- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOExceptionRead lots of bytes.- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionRead lots of specific bytes.- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
basicRead
protected int basicRead(byte[] b, int off, int len, int totalSoFar) throws java.io.IOExceptionBasic read, which uses the server object to throttle activity.- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOExceptionSkip- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOExceptionGet available.- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
mark
public void mark(int readLimit)
Mark.- Overrides:
markin classjava.io.InputStream
-
reset
public void reset() throws java.io.IOExceptionReset.- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
Check if mark is supported.- Overrides:
markSupportedin classjava.io.InputStream
-
close
public void close() throws java.io.IOExceptionClose.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
-