public class S3Handle extends StreamHandle
IRandomAccess,
StreamHandle,
URLConnectionStreamHandle.Settings| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_S3_PROTOCOL
Default protocol for fetching s3://
|
protected static int |
S3_MAX_FORWARD_SEEK
If seeking more than this distance reset and reopen at offset
|
protected static Pattern |
SCHEME_PARSER |
| Constructor and Description |
|---|
S3Handle(String url)
Open an S3 file
|
S3Handle(String uristr,
boolean initialize,
StreamHandle.Settings s)
Open an S3 file
|
| Modifier and Type | Method and Description |
|---|---|
static String |
cacheObject(String url,
StreamHandle.Settings s)
Download an S3 object to a file system cache if it doesn't already exist
|
static boolean |
canHandleScheme(String url)
Return true if this is a URL with an s3 scheme
|
protected void |
connect()
Connect to the server
|
protected void |
downloadObject(Path destination) |
boolean |
exists()
Does this represent an accessible location?
|
String |
getBucket() |
String |
getCacheKey() |
String |
getPath() |
int |
getPort() |
String |
getServer() |
protected void |
initialize()
Check bucket or object exists
|
boolean |
isBucket()
Is this an accessible bucket?
TODO: If this bucket doesn't exist do we return false or thrown an exception?
|
long |
length()
Returns the length of this stream.
|
protected void |
resetStream()
Close and reopen the stream; the stream pointer and mark should be
reset to 0.
|
protected void |
resetStream(long offset)
Reset the stream to an offset position
|
void |
seek(long pos)
Sets the stream pointer offset, measured from the beginning
of this stream, at which the next read or write occurs.
|
String |
toString() |
close, getFilePointer, getOrder, read, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setOrder, skipBytes, skipBytes, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFpublic static final String DEFAULT_S3_PROTOCOL
protected static final Pattern SCHEME_PARSER
protected static final int S3_MAX_FORWARD_SEEK
public S3Handle(String url) throws IOException
url - the full URL to the S3 resourceIOException - if there is an error during openingpublic S3Handle(String uristr, boolean initialize, StreamHandle.Settings s) throws IOException
uristr - the full URL to the S3 resourceinitialize - If true open the stream, otherwise just parse connection
strings - custom settings objectIOException - if there is an error during openingpublic static boolean canHandleScheme(String url)
url - URLprotected void connect()
throws IOException
IOException - if there was an error connecting to the serverprotected void initialize()
throws IOException,
S3ClientServiceException
IOException - if unable to get the objectS3ClientServiceException - if unable to get the objectpublic String getServer()
public int getPort()
public String getBucket()
public String getPath()
public static String cacheObject(String url, StreamHandle.Settings s) throws IOException, HandleException
url - the full URL to the S3 resources - custom settings objectIOException - if there is an error during reading or writingHandleException - if no destination for the cache is providedpublic String getCacheKey()
protected void downloadObject(Path destination) throws HandleException, IOException
HandleExceptionIOExceptionpublic boolean isBucket()
public long length()
throws IOException
IRandomAccesslength in interface IRandomAccesslength in class StreamHandleIOException - if the length cannot be retrievedpublic void seek(long pos)
throws IOException
IRandomAccessseek in interface IRandomAccessseek in class StreamHandlepos - new byte offset (pointer) in the current stream.
Unless otherwise noted, may be larger or smaller than the
current pointer, but must be non-negative and less than the
value of #length()IOException - if pos is invalid or the seek failsStreamHandle.seek(long)protected void resetStream()
throws IOException
StreamHandleresetStream in class StreamHandleIOException - if the stream cannot be resetStreamHandle.resetStream()public boolean exists()
throws IOException
exists in interface IRandomAccessexists in class StreamHandleIOException - if unable to determine whether this location is accessibleprotected void resetStream(long offset)
throws IOException
offset - Offset into objectIOException - if there is an error during reading or writingCopyright © 2005–2024 Open Microscopy Environment. All rights reserved.