public class ADLFileInputStream extends InputStream
Thread-safety: Note that methods in this class are NOT thread-safe.
Modifier and Type | Method and Description |
---|---|
int |
available()
returns the remaining number of bytes available to read from the buffer, without having to call
the server
|
void |
close() |
String |
getFilename() |
long |
getPos()
gets the position of the cursor within the file
|
long |
length()
Returns the length of the file that this stream refers to.
|
void |
mark(int readlimit)
Not supported by this stream.
|
boolean |
markSupported()
gets whether mark and reset are supported by
ADLFileInputStream . |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
int |
read(long position,
byte[] b,
int offset,
int length)
Read upto the specified number of bytes, from a given
position within a file, and return the number of bytes read.
|
protected long |
readFromService()
Read from service attempts to read
blocksize bytes from service. |
void |
reset()
Not supported by this stream.
|
void |
seek(long n)
Seek to given position in stream.
|
void |
setBufferSize(int newSize)
Sets the size of the internal read buffer (default is 4MB).
|
void |
setReadAheadQueueDepth(int queueDepth)
Sets the Queue depth to be used for read-aheads in this stream.
|
long |
skip(long n) |
protected long |
slurpFullFile()
Reads the whole file into buffer.
|
void |
unbuffer()
invalidates the buffer.
|
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
protected long readFromService() throws IOException
blocksize
bytes from service.
Returns how many bytes are actually read, could be less than blocksize.ADLException
- if errorIOException
protected long slurpFullFile() throws IOException
IOException
- throws IOException if there is an errorpublic int read(long position, byte[] b, int offset, int length) throws IOException
position
- position in file to read fromb
- byte[] buffer to read intooffset
- offset into the byte buffer at which to read the data intolength
- number of bytes to readposition
is at or after end of file, then -1 is returned.IOException
- thrown if there is an error in readingpublic void seek(long n) throws IOException, EOFException
n
- position to seek toIOException
- if there is an errorEOFException
- if attempting to seek past end of filepublic long skip(long n) throws IOException
skip
in class InputStream
IOException
public void setBufferSize(int newSize) throws IOException
newSize
- requested size of bufferADLException
- if there is an errorIOException
public void setReadAheadQueueDepth(int queueDepth)
queueDepth
- the desired queue depth, set to 0 to disable read-aheadpublic int available() throws IOException
available
in class InputStream
IOException
- throws ADLException
if call failspublic long length() throws IOException
IOException
- if the stream is closedpublic long getPos() throws IOException
IOException
- throws IOException
if there is an errorpublic void unbuffer() throws IOException
IOException
- throws IOException
if there is an errorpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public String getFilename()
public void mark(int readlimit)
UnsupportedOperationException
mark
in class InputStream
readlimit
- ignoredpublic void reset() throws IOException
UnsupportedOperationException
reset
in class InputStream
IOException
public boolean markSupported()
ADLFileInputStream
. Always returns false.markSupported
in class InputStream
false
Copyright © 2019 Microsoft Corporation. All rights reserved.