Class FsBlobContainer

    • Field Detail

      • path

        protected final Path path
    • Method Detail

      • listBlobs

        public Map<String,​BlobMetaData> listBlobs()
                                                 throws IOException
        Description copied from interface: BlobContainer
        Lists all blobs in the container.
        Returns:
        A map of all the blobs in the container. The keys in the map are the names of the blobs and the values are BlobMetaData, containing basic information about each blob.
        Throws:
        IOException - if there were any failures in reading from the blob container.
      • children

        public Map<String,​BlobContainer> children()
                                                 throws IOException
        Description copied from interface: BlobContainer
        Lists all child containers under this container. A child container is defined as a container whose BlobContainer.path() method returns a path that has this containers BlobContainer.path() return as its prefix and has one more path element than the current container's path.
        Returns:
        Map of name of the child container to child container
        Throws:
        IOException - on failure to list child containers
      • listBlobsByPrefix

        public Map<String,​BlobMetaData> listBlobsByPrefix​(String blobNamePrefix)
                                                         throws IOException
        Description copied from interface: BlobContainer
        Lists all blobs in the container that match the specified prefix.
        Parameters:
        blobNamePrefix - The prefix to match against blob names in the container.
        Returns:
        A map of the matching blobs in the container. The keys in the map are the names of the blobs and the values are BlobMetaData, containing basic information about each blob.
        Throws:
        IOException - if there were any failures in reading from the blob container.
      • deleteBlob

        public void deleteBlob​(String blobName)
                        throws IOException
        Description copied from interface: BlobContainer
        Deletes the blob with the given name, if the blob exists. If the blob does not exist, this method may throw a NoSuchFileException if the underlying implementation supports an existence check before delete.
        Parameters:
        blobName - The name of the blob to delete.
        Throws:
        NoSuchFileException - if the blob does not exist
        IOException - if the blob exists but could not be deleted.
      • writeBlob

        public void writeBlob​(String blobName,
                              InputStream inputStream,
                              long blobSize,
                              boolean failIfAlreadyExists)
                       throws IOException
        Description copied from interface: BlobContainer
        Reads blob content from the input stream and writes it to the container in a new blob with the given name. This method assumes the container does not already contain a blob of the same blobName. If a blob by the same name already exists, the operation will fail and an IOException will be thrown.
        Parameters:
        blobName - The name of the blob to write the contents of the input stream to.
        inputStream - The input stream from which to retrieve the bytes to write to the blob.
        blobSize - The size of the blob to be written, in bytes. It is implementation dependent whether this value is used in writing the blob to the repository.
        failIfAlreadyExists - whether to throw a FileAlreadyExistsException if the given blob already exists
        Throws:
        FileAlreadyExistsException - if failIfAlreadyExists is true and a blob by the same name already exists
        IOException - if the input stream could not be read, or the target blob could not be written to.
      • writeBlobAtomic

        public void writeBlobAtomic​(String blobName,
                                    InputStream inputStream,
                                    long blobSize,
                                    boolean failIfAlreadyExists)
                             throws IOException
        Description copied from interface: BlobContainer
        Reads blob content from the input stream and writes it to the container in a new blob with the given name, using an atomic write operation if the implementation supports it. This method assumes the container does not already contain a blob of the same blobName. If a blob by the same name already exists, the operation will fail and an IOException will be thrown.
        Parameters:
        blobName - The name of the blob to write the contents of the input stream to.
        inputStream - The input stream from which to retrieve the bytes to write to the blob.
        blobSize - The size of the blob to be written, in bytes. It is implementation dependent whether this value is used in writing the blob to the repository.
        failIfAlreadyExists - whether to throw a FileAlreadyExistsException if the given blob already exists
        Throws:
        FileAlreadyExistsException - if failIfAlreadyExists is true and a blob by the same name already exists
        IOException - if the input stream could not be read, or the target blob could not be written to.
      • tempBlobName

        public static String tempBlobName​(String blobName)
      • isTempBlobName

        public static boolean isTempBlobName​(String blobName)
        Returns true if the blob is a leftover temporary blob. The temporary blobs might be left after failed atomic write operation.