Class Operator

All Implemented Interfaces:
AutoCloseable

public class Operator extends NativeObject
Operator represents an underneath OpenDAL operator that accesses data synchronously.
  • Field Details

  • Method Details

    • of

      public static Operator of(ServiceConfig config)
      Construct an OpenDAL blocking operator.
      Parameters:
      config - the config of the underneath service to access data from.
    • of

      public static Operator of(String scheme, Map<String,String> map)
      Construct an OpenDAL blocking operator:

      You can find all possible schemes here and see what config options each service supports.

      Parameters:
      scheme - the name of the underneath service to access data from.
      map - a map of properties to construct the underneath operator.
    • duplicate

      public Operator duplicate()
      Returns:
      the cloned blocking operator.
      See Also:
    • write

      public void write(String path, String content)
    • write

      public void write(String path, byte[] content)
    • write

      public void write(String path, String content, WriteOptions options)
    • write

      public void write(String path, byte[] content, WriteOptions options)
    • createOutputStream

      public OperatorOutputStream createOutputStream(String path)
    • createOutputStream

      public OperatorOutputStream createOutputStream(String path, int maxBytes)
    • createOutputStream

      public OperatorOutputStream createOutputStream(String path, WriteOptions options)
    • read

      public byte[] read(String path)
    • read

      public byte[] read(String path, long offset, long length)
    • read

      public byte[] read(String path, ReadOptions options)
    • createReader

      public OperatorReader createReader(String path)
      Creates a reusable reader for a file with default execution options.
      Parameters:
      path - file path
      Returns:
      a reader that the caller must close
      See Also:
    • createReader

      public OperatorReader createReader(String path, ReaderOptions options)
      Creates a reusable reader for a file. Options apply to every read through the reader; each read selects its own byte range. The reader can outlive this operator. Creation does not read file contents or guarantee that the file exists. Version selection and conditions apply to all requests through the reader, including streams. All conditions must hold; a failed condition on an existing file fails with ConditionNotMatch and a missing file fails with NotFound. Depending on the service, errors may surface at creation or during reading.
      Parameters:
      path - file path
      options - reader execution options
      Returns:
      a reader that the caller must close
      Throws:
      OpenDALException - if options are invalid (ConfigInvalid), the path is a directory (IsADirectory), or the service does not support reads or a requested option (Unsupported)
      IllegalStateException - if this operator is closed
    • createInputStream

      public OperatorInputStream createInputStream(String path)
    • createInputStream

      public OperatorInputStream createInputStream(String path, ReadOptions options)
    • delete

      public void delete(String path)
    • stat

      public Metadata stat(String path)
    • stat

      public Metadata stat(String path, StatOptions options)
    • createDir

      public void createDir(String path)
    • copy

      public void copy(String sourcePath, String targetPath)
    • rename

      public void rename(String sourcePath, String targetPath)
    • removeAll

      public void removeAll(String path)
    • list

      public List<Entry> list(String path)
    • list

      public List<Entry> list(String path, ListOptions options)
    • disposeInternal

      protected void disposeInternal(long handle)
      Description copied from class: NativeObject
      Deletes underlying native object pointer.
      Specified by:
      disposeInternal in class NativeObject
      Parameters:
      handle - to the native object pointer