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 |
|---|---|
int |
available() |
void |
close() |
protected InputStream |
getInputStream() |
long |
getPos()
Return the current offset from the start of the file
|
protected abstract URL |
getResolvedUrl(HttpURLConnection connection) |
protected org.apache.hadoop.hdfs.web.ByteRangeInputStream.InputStreamAndFileLength |
openInputStream(long startOffset) |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
int |
read(long position,
byte[] buffer,
int offset,
int length) |
void |
readFully(long position,
byte[] buffer,
int offset,
int length) |
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.
|
readFully, validatePositionedReadArgsmark, markSupported, read, reset, skipprotected 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 urlIOExceptionprotected abstract URL getResolvedUrl(HttpURLConnection connection) throws IOException
IOExceptionprotected InputStream getInputStream() throws IOException
IOExceptionprotected org.apache.hadoop.hdfs.web.ByteRangeInputStream.InputStreamAndFileLength openInputStream(long startOffset)
throws IOException
IOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(@Nonnull byte[] b, int off, int len) throws IOException
read in class InputStreamIOExceptionpublic void seek(long pos)
throws IOException
seek in interface org.apache.hadoop.fs.Seekableseek in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic int read(long position,
byte[] buffer,
int offset,
int length)
throws IOException
read in interface org.apache.hadoop.fs.PositionedReadableread in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic void readFully(long position,
byte[] buffer,
int offset,
int length)
throws IOException
readFully in interface org.apache.hadoop.fs.PositionedReadablereadFully in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic long getPos()
throws IOException
getPos in interface org.apache.hadoop.fs.SeekablegetPos in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic boolean seekToNewSource(long targetPos)
throws IOException
seekToNewSource in class org.apache.hadoop.fs.FSInputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOExceptionCopyright © 2022 Apache Software Foundation. All rights reserved.