Class MFileS3

  • All Implemented Interfaces:
    Comparable<MFile>, MFile

    public class MFileS3
    extends Object
    implements MFile
    Implements MFile for objects stored on AWS S3 compatible object stores.
    Since:
    5.4.0
    • 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 interface MFile
        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
        Specified by:
        getLength in interface MFile
        Returns:
        Size of file in bytes or -1 if unknown
      • updateLength

        public long updateLength()
        Update file length by fetching from a head request
      • isDirectory

        public boolean isDirectory()
        Specified by:
        isDirectory in interface MFile
      • getPath

        public String getPath()
        Description copied from interface: MFile
        Get full path name, replace \\ with /
        Specified by:
        getPath in interface MFile
        Returns:
        full path name
      • getName

        public String getName()
        Description copied from interface: MFile
        The name is the farthest element from the root in the directory hierarchy.
        Specified by:
        getName in interface MFile
        Returns:
        the file name
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • exists

        public boolean exists()
        Description copied from interface: MFile
        Check if the MFile exists
        Specified by:
        exists in interface MFile
        Returns:
        true if the MFile exists, else false
      • 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 interface MFile
        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 interface MFile
        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 interface MFile
        Parameters:
        outputStream - the OutputStream the MFile contents should be written to
        offset - the index of the first byte to write out
        maxBytes - the maximum number of bytes to copy
        Throws:
        IOException
      • getChild

        @Nullable
        public MFileS3 getChild​(String newFilename)
        Description copied from interface: MFile
        Get child MFile of this MFile
        Specified by:
        getChild in interface MFile
        Parameters:
        newFilename - the relative file path of the new MFile
        Returns:
        the new MFile or null if the file can't be resolved