java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.Seekablepublic abstract class ByteRangeInputStream
extends org.apache.hadoop.fs.FSInputStream
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ByteRangeInputStream.URLOpener |
This class wraps a URL and provides method to open connection.
|
| Modifier and Type | Field | Description |
|---|---|---|
protected long |
currentPos |
|
protected java.lang.Long |
fileLength |
|
protected java.io.InputStream |
in |
|
protected ByteRangeInputStream.URLOpener |
originalURL |
|
protected ByteRangeInputStream.URLOpener |
resolvedURL |
|
protected long |
startPos |
| Constructor | Description |
|---|---|
ByteRangeInputStream(ByteRangeInputStream.URLOpener o,
ByteRangeInputStream.URLOpener r) |
Create with the specified URLOpeners.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
|
void |
close() |
|
protected java.io.InputStream |
getInputStream() |
|
long |
getPos() |
Return the current offset from the start of the file
|
protected abstract java.net.URL |
getResolvedUrl(java.net.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, toString, validatePositionedReadArgsmark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferToprotected java.io.InputStream in
protected final ByteRangeInputStream.URLOpener originalURL
protected final ByteRangeInputStream.URLOpener resolvedURL
protected long startPos
protected long currentPos
protected java.lang.Long fileLength
public ByteRangeInputStream(ByteRangeInputStream.URLOpener o, ByteRangeInputStream.URLOpener r) throws java.io.IOException
o - Original urlr - Resolved urljava.io.IOExceptionprotected abstract java.net.URL getResolvedUrl(java.net.HttpURLConnection connection)
throws java.io.IOException
java.io.IOException@VisibleForTesting
protected java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException@VisibleForTesting
protected org.apache.hadoop.hdfs.web.ByteRangeInputStream.InputStreamAndFileLength openInputStream(long startOffset)
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(@Nonnull
byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void seek(long pos)
throws java.io.IOException
seek in interface org.apache.hadoop.fs.Seekableseek in class org.apache.hadoop.fs.FSInputStreamjava.io.IOExceptionpublic int read(long position,
byte[] buffer,
int offset,
int length)
throws java.io.IOException
read in interface org.apache.hadoop.fs.PositionedReadableread in class org.apache.hadoop.fs.FSInputStreamjava.io.IOExceptionpublic void readFully(long position,
byte[] buffer,
int offset,
int length)
throws java.io.IOException
readFully in interface org.apache.hadoop.fs.PositionedReadablereadFully in class org.apache.hadoop.fs.FSInputStreamjava.io.IOExceptionpublic long getPos()
throws java.io.IOException
getPos in interface org.apache.hadoop.fs.SeekablegetPos in class org.apache.hadoop.fs.FSInputStreamjava.io.IOExceptionpublic boolean seekToNewSource(long targetPos)
throws java.io.IOException
seekToNewSource in interface org.apache.hadoop.fs.SeekableseekToNewSource in class org.apache.hadoop.fs.FSInputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.