Class NilStorageConnector

    • Method Detail

      • pathExists

        public boolean pathExists​(String path)
        Description copied from interface: StorageConnector
        Check if the path exists in the underlying storage layer. Most implementations prepend the input path with a basePath.
        Specified by:
        pathExists in interface StorageConnector
        Returns:
        true if path exists else false.
      • read

        public InputStream read​(String path)
        Description copied from interface: StorageConnector
        Reads the data present at the path in the underlying storage system. Most implementations prepend the input path with a basePath. The caller should take care of closing the stream when done or in case of error.
        Specified by:
        read in interface StorageConnector
        Returns:
        InputStream
      • readRange

        public InputStream readRange​(String path,
                                     long from,
                                     long size)
        Description copied from interface: StorageConnector
        Reads the data present for a given range at the path in the underlying storage system. Most implementations prepend the input path with a basePath. The caller should take care of closing the stream when done or in case of error. Further, the caller must ensure that the start offset and the size of the read are valid parameters for the given path for correct behavior.
        Specified by:
        readRange in interface StorageConnector
        Parameters:
        path - The path to read data from
        from - Start offset of the read in the path
        size - Length of the read to be done
        Returns:
        InputStream starting from the given offset limited by the given size
      • write

        public OutputStream write​(String path)
        Description copied from interface: StorageConnector
        Open an OutputStream for writing data to the path in the underlying storage system. Most implementations prepend the input path with a basePath. Callers are adivised to namespace there files as there might be race conditions. The caller should take care of closing the stream when done or in case of error.
        Specified by:
        write in interface StorageConnector
        Returns:
      • deleteFile

        public void deleteFile​(String path)
        Description copied from interface: StorageConnector
        Delete file present at the input path. Most implementations prepend the input path with a basePath. If the path is a directory, this method throws an exception.
        Specified by:
        deleteFile in interface StorageConnector
        Parameters:
        path - to delete
      • deleteFiles

        public void deleteFiles​(Iterable<String> paths)
        Description copied from interface: StorageConnector
        Delete files present at the input paths. Most implementations prepend all the input paths with the basePath.
        This method is recommended in case we need to delete a batch of files. If the path is a directory, this method throws an exception.
        Specified by:
        deleteFiles in interface StorageConnector
        Parameters:
        paths - Iterable of the paths to delete.
      • deleteRecursively

        public void deleteRecursively​(String path)
        Description copied from interface: StorageConnector
        Delete a directory pointed to by the path and also recursively deletes all files/directories in said directory. Most implementations prepend the input path with a basePath.
        Specified by:
        deleteRecursively in interface StorageConnector
        Parameters:
        path - path
      • listDir

        public Iterator<String> listDir​(String dirName)
        Description copied from interface: StorageConnector
        Returns a lazy iterator containing all the files present in the path. The returned filenames should be such that joining the dirName and the file name form the full path that can be used as the arguments for other methods of the storage connector. For example, for a S3 path such as s3://bucket/parent1/parent2/child, the filename returned for the input path "parent1/parent2" should be "child" and for input "parent1" should be "parent2/child"
        Specified by:
        listDir in interface StorageConnector