public abstract class ByteRangeInputStream extends org.apache.hadoop.fs.FSInputStream
Modifier and Type | Class and Description |
---|---|
static class |
ByteRangeInputStream.URLOpener
This class wraps a URL and provides method to open connection.
|
Modifier and Type | Field and Description |
---|---|
protected long |
currentPos |
protected Long |
fileLength |
protected InputStream |
in |
protected ByteRangeInputStream.URLOpener |
originalURL |
protected ByteRangeInputStream.URLOpener |
resolvedURL |
protected long |
startPos |
Constructor and Description |
---|
ByteRangeInputStream(ByteRangeInputStream.URLOpener o,
ByteRangeInputStream.URLOpener r)
Create with the specified URLOpeners.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected InputStream |
getInputStream() |
long |
getPos()
Return the current offset from the start of the file
|
protected abstract URL |
getResolvedUrl(HttpURLConnection connection) |
protected InputStream |
openInputStream() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
seek(long pos)
Seek to the given offset from the start of the file.
|
boolean |
seekToNewSource(long targetPos)
Seeks a different copy of the data.
|
available, mark, markSupported, read, reset, skip
protected InputStream in
protected final ByteRangeInputStream.URLOpener originalURL
protected final ByteRangeInputStream.URLOpener resolvedURL
protected long startPos
protected long currentPos
protected Long fileLength
public ByteRangeInputStream(ByteRangeInputStream.URLOpener o, ByteRangeInputStream.URLOpener r) throws IOException
o
- Original urlr
- Resolved urlIOException
protected abstract URL getResolvedUrl(HttpURLConnection connection) throws IOException
IOException
protected InputStream getInputStream() throws IOException
IOException
protected InputStream openInputStream() throws IOException
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public void seek(long pos) throws IOException
seek
in interface org.apache.hadoop.fs.Seekable
seek
in class org.apache.hadoop.fs.FSInputStream
IOException
public long getPos() throws IOException
getPos
in interface org.apache.hadoop.fs.Seekable
getPos
in class org.apache.hadoop.fs.FSInputStream
IOException
public boolean seekToNewSource(long targetPos) throws IOException
seekToNewSource
in interface org.apache.hadoop.fs.Seekable
seekToNewSource
in class org.apache.hadoop.fs.FSInputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2014 Apache Software Foundation. All Rights Reserved.