Package thredds.inventory.s3
Class MFileS3
- java.lang.Object
-
- thredds.inventory.s3.MFileS3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MFileS3.Provider
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MFile o)
boolean
equals(Object o)
boolean
exists()
Check if the MFile existsObject
getAuxInfo()
MFileS3
getChild(String newFilename)
Get child MFile of this MFilesoftware.amazon.awssdk.core.ResponseInputStream<software.amazon.awssdk.services.s3.model.GetObjectResponse>
getInputStream()
Get the MFile InputStreamlong
getLastModified()
Get time of last modification at the time the MFile object was createdlong
getLength()
Size of file in bytesString
getName()
The name is the farthest element from the root in the directory hierarchy.MFile
getParent()
Get the parent of thisString
getPath()
Get full path name, replace \\ with /int
hashCode()
boolean
isDirectory()
void
setAuxInfo(Object auxInfo)
long
updateLastModified()
Update last modified by fetching from a head requestlong
updateLength()
Update file length by fetching from a head requestvoid
writeToStream(OutputStream outputStream)
Write the MFile to an OutputStreamvoid
writeToStream(OutputStream outputStream, long offset, long maxBytes)
Write the MFile to an OutputStream-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface thredds.inventory.MFile
isReadable, isZipFile
-
-
-
-
Constructor Detail
-
MFileS3
public MFileS3(String s3Uri) throws IOException
- Throws:
IOException
-
MFileS3
public MFileS3(CdmS3Uri s3Uri)
-
MFileS3
public MFileS3(String s3Uri, long len, long lm) throws IOException
- Throws:
IOException
-
MFileS3
public MFileS3(CdmS3Uri s3Uri, long len, long lm)
-
-
Method Detail
-
getLastModified
public long getLastModified()
Description copied from interface:MFile
Get time of last modification at the time the MFile object was created- Specified by:
getLastModified
in interfaceMFile
- Returns:
- time of last modification in Unix time (msecs since reference), or -1 if unknown
-
updateLastModified
public long updateLastModified()
Update last modified by fetching from a head request
-
getLength
public long getLength()
Description copied from interface:MFile
Size of file in bytes
-
updateLength
public long updateLength()
Update file length by fetching from a head request
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectory
in interfaceMFile
-
getPath
public String getPath()
Description copied from interface:MFile
Get full path name, replace \\ with /
-
getName
public String getName()
Description copied from interface:MFile
The name is the farthest element from the root in the directory hierarchy.
-
getParent
@Nullable public MFile getParent() throws IOException
Description copied from interface:MFile
Get the parent of this- Specified by:
getParent
in interfaceMFile
- Returns:
- the parent or null
- Throws:
IOException
-
compareTo
public int compareTo(MFile o)
- Specified by:
compareTo
in interfaceComparable<MFile>
- Specified by:
compareTo
in interfaceMFile
-
getAuxInfo
@Nullable public Object getAuxInfo()
- Specified by:
getAuxInfo
in interfaceMFile
-
setAuxInfo
public void setAuxInfo(Object auxInfo)
- Specified by:
setAuxInfo
in interfaceMFile
-
exists
public boolean exists()
Description copied from interface:MFile
Check if the MFile exists
-
getInputStream
public software.amazon.awssdk.core.ResponseInputStream<software.amazon.awssdk.services.s3.model.GetObjectResponse> getInputStream()
Description copied from interface:MFile
Get the MFile InputStream- Specified by:
getInputStream
in interfaceMFile
- Returns:
- the MFile InputStream
-
writeToStream
public void writeToStream(OutputStream outputStream) throws IOException
Description copied from interface:MFile
Write the MFile to an OutputStream- Specified by:
writeToStream
in interfaceMFile
- Parameters:
outputStream
- the OutputStream the MFile contents should be written to- Throws:
IOException
-
writeToStream
public void writeToStream(OutputStream outputStream, long offset, long maxBytes) throws IOException
Description copied from interface:MFile
Write the MFile to an OutputStream- Specified by:
writeToStream
in interfaceMFile
- Parameters:
outputStream
- the OutputStream the MFile contents should be written tooffset
- the index of the first byte to write outmaxBytes
- the maximum number of bytes to copy- Throws:
IOException
-
-