Package ucar.unidata.io.http
Class HTTPRandomAccessFile
- java.lang.Object
-
- ucar.unidata.io.RandomAccessFile
-
- ucar.unidata.io.RemoteRandomAccessFile
-
- ucar.unidata.io.http.HTTPRandomAccessFile
-
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable,FileCacheable,ReadableRemoteFile
public final class HTTPRandomAccessFile extends RemoteRandomAccessFile
Gives access to files over HTTP, using "Accept-Ranges" HTTP header to do random access.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHTTPRandomAccessFile.ProviderHook into service provider interface for RandomAccessFileProvider.
-
Field Summary
-
Fields inherited from class ucar.unidata.io.RemoteRandomAccessFile
defaultMaxReadCacheSize, defaultRemoteFileBufferSize, defaultRemoteFileTimeout, url
-
Fields inherited from class ucar.unidata.io.RandomAccessFile
allFiles, BIG_ENDIAN, bigEndian, buffer, bufferModified, bufferStart, dataEnd, dataSize, debugAccess, debugLeaks, defaultBufferSize, endOfFile, file, fileChannel, filePosition, LITTLE_ENDIAN, location, openFiles, readonly, showOpen, showRead
-
-
Constructor Summary
Constructors Constructor Description HTTPRandomAccessFile(String url)HTTPRandomAccessFile(String url, int bufferSize, long maxRemoteCacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseRemote()Close any resources used to enable remote reading.longgetLastModified()Always returns0L, as we cannot easily determine the last time that a remote file was modified.longlength()Get the length of the file.intreadRemote(long pos, byte[] buff, int offset, int len)Read directly from remote file, without going through the buffer.-
Methods inherited from class ucar.unidata.io.RemoteRandomAccessFile
close, read_, readToByteChannel
-
Methods inherited from class ucar.unidata.io.RandomAccessFile
acquire, acquire, eject, enableDefaultGlobalFileCache, flush, getAllFiles, getBufferSize, getDebugLeaks, getDebugNbytes, getDebugNseeks, getFilePointer, getGlobalFileCache, getLocation, getMaxOpenFileCount, getOpenFileCount, getOpenFiles, getRandomAccessFile, isAtEndOfFile, isDirectory, order, order, reacquire, read, read, read, readBoolean, readBuffer, readByte, readBytes, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLine, readLong, readLong, readShort, readShort, readString, readString, readStringMax, readStringMax, readUnsignedByte, readUnsignedShort, readUTF, release, searchForward, seek, setBufferSize, setDebugAccess, setDebugLeaks, setExtendMode, setFileCache, setGlobalFileCache, setMinLength, shutdown, skipBytes, skipBytes, toString, unread, write, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeChar, writeChar, writeChar, writeChar, writeChar, writeChar, writeChars, writeChars, writeChars, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeInt, writeInt, writeInt, writeInt, writeInt, writeInt, writeLong, writeLong, writeLong, writeLong, writeLong, writeLong, writeShort, writeShort, writeShort, writeShort, writeShort, writeShort, writeUTF
-
-
-
-
Constructor Detail
-
HTTPRandomAccessFile
public HTTPRandomAccessFile(String url) throws IOException
- Throws:
IOException
-
HTTPRandomAccessFile
public HTTPRandomAccessFile(String url, int bufferSize, long maxRemoteCacheSize) throws IOException
- Throws:
IOException
-
-
Method Detail
-
closeRemote
public void closeRemote()
Description copied from interface:ReadableRemoteFileClose any resources used to enable remote reading. For example, HTTPSession from httpservices, or S3Client from the AWS SDK
-
readRemote
public int readRemote(long pos, byte[] buff, int offset, int len) throws IOExceptionRead directly from remote file, without going through the buffer.- Parameters:
pos- start here in the filebuff- put data into this bufferoffset- buffer offsetlen- this number of bytes- Returns:
- actual number of bytes read
- Throws:
IOException- on io error
-
length
public long length()
Description copied from class:RandomAccessFileGet the length of the file. The data in the buffer (which may not have been written the disk yet) is taken into account.- Overrides:
lengthin classRandomAccessFile- Returns:
- the length of the file in bytes.
-
getLastModified
public long getLastModified()
Always returns0L, as we cannot easily determine the last time that a remote file was modified.- Specified by:
getLastModifiedin interfaceFileCacheable- Overrides:
getLastModifiedin classRandomAccessFile- Returns:
0L, always.
-
-