public class HTTPRandomAccessFile extends RandomAccessFile
Modifier and Type | Field and Description |
---|---|
static int |
defaultHTTPBufferSize |
allFiles, BIG_ENDIAN, bigEndian, buffer, bufferStart, dataEnd, dataSize, debugAccess, debugLeaks, defaultBufferSize, endOfFile, file, fileCache, fileChannel, filePosition, LITTLE_ENDIAN, location, openFiles, readonly, showOpen, showRead
Constructor and Description |
---|
HTTPRandomAccessFile(String url) |
HTTPRandomAccessFile(String url,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file, and release any associated system resources.
|
long |
length()
Get the length of the file.
|
protected int |
read_(long pos,
byte[] buff,
int offset,
int len)
Read directly from file, without going through the buffer.
|
long |
readToByteChannel(WritableByteChannel dest,
long offset,
long nbytes)
Read
nbytes bytes, at the specified file offset, send to a WritableByteChannel. |
flush, getAllFiles, getBufferSize, getDebugLeaks, getDebugNbytes, getDebugNseeks, getFilePointer, getLastModified, getLocation, getOpenFiles, getRandomAccessFile, isAtEndOfFile, order, order, read, read, read, readBoolean, readBuffer, readByte, readBytes, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLong, readLong, readShort, readShort, readString, readUnsignedByte, readUnsignedShort, readUTF, searchForward, seek, setBufferSize, setDebugAccess, setDebugLeaks, setExtendMode, setFileCache, setMinLength, skipBytes, skipBytes, toString, unread, write, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeChar, writeChar, writeChars, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeLong, writeLong, writeShort, writeShort, writeUTF
public HTTPRandomAccessFile(String url) throws IOException
IOException
public HTTPRandomAccessFile(String url, int bufferSize) throws IOException
IOException
public void close() throws IOException
RandomAccessFile
close
in interface FileCacheable
close
in class RandomAccessFile
IOException
- if an I/O error occurrs.protected int read_(long pos, byte[] buff, int offset, int len) throws IOException
read_
in class RandomAccessFile
pos
- start here in the filebuff
- put data into this bufferoffset
- buffer offsetlen
- this number of bytesIOException
- on io errorpublic long readToByteChannel(WritableByteChannel dest, long offset, long nbytes) throws IOException
RandomAccessFile
nbytes
bytes, at the specified file offset, send to a WritableByteChannel.
This will block until all bytes are read.
This uses the underlying file channel directly, bypassing all user buffers.readToByteChannel
in class RandomAccessFile
dest
- write to this WritableByteChannel.offset
- the offset in the file where copying will start.nbytes
- the number of bytes to read.IOException
- if an I/O error occurs.public long length() throws IOException
RandomAccessFile
length
in class RandomAccessFile
IOException
- if an I/O error occurrs.Copyright © 1999–2015 UCAR/Unidata. All rights reserved.