Class RateLimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.accumulo.core.file.streams.RateLimitedInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.hadoop.fs.Seekable
public class RateLimitedInputStream extends FilterInputStream implements org.apache.hadoop.fs.Seekable
A decorator for anInputStream
which limits the rate at which reads are performed.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description RateLimitedInputStream(StreamType stream, RateLimiter rateLimiter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getPos()
int
read()
int
read(byte[] buffer, int offset, int length)
void
seek(long pos)
boolean
seekToNewSource(long targetPos)
-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
RateLimitedInputStream
public RateLimitedInputStream(StreamType stream, RateLimiter rateLimiter)
-
-
Method Detail
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
seek
public void seek(long pos) throws IOException
- Specified by:
seek
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
getPos
public long getPos() throws IOException
- Specified by:
getPos
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
seekToNewSource
public boolean seekToNewSource(long targetPos) throws IOException
- Specified by:
seekToNewSource
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
-