Package ucar.unidata.io.s3
Class S3RandomAccessFile
- java.lang.Object
-
- ucar.unidata.io.RandomAccessFile
-
- ucar.unidata.io.RemoteRandomAccessFile
-
- ucar.unidata.io.s3.S3RandomAccessFile
-
- All Implemented Interfaces:
Closeable
,DataInput
,DataOutput
,AutoCloseable
,FileCacheable
,ReadableRemoteFile
public final class S3RandomAccessFile extends RemoteRandomAccessFile implements ReadableRemoteFile, Closeable
Manage random access file level access to objects stored on AWS S3 compatible Object Stores. Extensions toRandomAccessFile
andRemoteRandomAccessFile
for objects stored on AWS S3 compatible Object Stores.- Since:
- 5.3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
S3RandomAccessFile.Provider
Hook into service provider interface to 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeRemote()
Close any resources used to enable remote reading.long
getLastModified()
Returns the time that the underlying file(s) were last modified.String
getLocation()
Get the file location, or name.String
getObjectName()
long
length()
Get the length of the file.int
readRemote(long pos, byte[] buff, int offset, int len)
Read directly from the remote service All reading goes through here or readToByteChannel; 1.-
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, 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
-
-
-
-
Method Detail
-
closeRemote
public void closeRemote()
Description copied from interface:ReadableRemoteFile
Close any resources used to enable remote reading. For example, HTTPSession from httpservices, or S3Client from the AWS SDK- Specified by:
closeRemote
in interfaceReadableRemoteFile
-
readRemote
public int readRemote(long pos, byte[] buff, int offset, int len) throws IOException
Read directly from the remote service All reading goes through here or readToByteChannel; 1. https://docs.aws.amazon.com/AmazonS3/latest/dev/RetrievingObjectUsingJava.html- Specified by:
readRemote
in interfaceReadableRemoteFile
- 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:RandomAccessFile
Get the length of the file. The data in the buffer (which may not have been written the disk yet) is taken into account.- Overrides:
length
in classRandomAccessFile
- Returns:
- the length of the file in bytes.
-
getLastModified
public long getLastModified()
Description copied from interface:FileCacheable
Returns the time that the underlying file(s) were last modified. If they've changed since they were stored in the cache, they will be closed and reopened withFileFactory
.- Specified by:
getLastModified
in interfaceFileCacheable
- Overrides:
getLastModified
in classRandomAccessFile
- Returns:
- a
long
value representing the time the file(s) were last modified or0L
if the last-modified time couldn't be determined for any reason.
-
getLocation
public String getLocation()
Description copied from class:RandomAccessFile
Get the file location, or name.- Specified by:
getLocation
in interfaceFileCacheable
- Overrides:
getLocation
in classRandomAccessFile
- Returns:
- file location
-
getObjectName
public String getObjectName()
-
-