Class StringRoot

java.lang.Object
space.arim.dazzleconf.backend.StringRoot
All Implemented Interfaces:
DataRoot, ReadableRoot

public final class StringRoot extends Object implements ReadableRoot
Implementation of data root for a string
  • Constructor Details

    • StringRoot

      public StringRoot(@NonNull String content)
      Creates from the given initial ccontent
      Parameters:
      content - the content
  • Method Details

    • dataExists

      public boolean dataExists() throws IOException
      Description copied from interface: DataRoot
      Checks whether the data is known to exist.
      Specified by:
      dataExists in interface DataRoot
      Returns:
      true if the data is known to be present, false if not present or if its existence cannot be determined
      Throws:
      IOException - if checking for data existence failed
    • readString

      public @NonNull String readString()
      Description copied from interface: ReadableRoot
      Reads to a string
      Specified by:
      readString in interface ReadableRoot
      Returns:
      the read content
    • openReader

      public <R> R openReader(@NonNull DataRoot.Operation<R,@NonNull Reader> operation) throws IOException
      Description copied from interface: ReadableRoot
      Opens a reader to the data
      Specified by:
      openReader in interface ReadableRoot
      Type Parameters:
      R - the result type
      Parameters:
      operation - the operation
      Returns:
      the operation result
      Throws:
      IOException - upon failure to open
    • writeString

      public void writeString(@NonNull String content)
      Description copied from interface: ReadableRoot
      Writes to a string
      Specified by:
      writeString in interface ReadableRoot
      Parameters:
      content - the content to write
    • openWriter

      public <R> R openWriter(@NonNull DataRoot.Operation<R,@NonNull Writer> operation) throws IOException
      Description copied from interface: ReadableRoot
      Opens a writer for the data
      Specified by:
      openWriter in interface ReadableRoot
      Type Parameters:
      R - the result type
      Parameters:
      operation - the operation
      Returns:
      the operation result
      Throws:
      IOException - upon failure to open