Class OpenOptions

java.lang.Object
io.vertx.core.file.OpenOptions

public class OpenOptions extends Object
Describes how an AsyncFile should be opened.
Author:
Tim Fox
  • Field Details

  • Constructor Details

    • OpenOptions

      public OpenOptions()
      Default constructor
    • OpenOptions

      public OpenOptions(OpenOptions other)
      Copy constructor
      Parameters:
      other - the options to copy
    • OpenOptions

      public OpenOptions(JsonObject json)
      Constructor to create options from JSON
      Parameters:
      json - the JSON
  • Method Details

    • getPerms

      public String getPerms()
      Get the permissions string to be used if creating a file
      Returns:
      the permissions string
    • setPerms

      public OpenOptions setPerms(String perms)
      Set the permissions string
      Parameters:
      perms - the permissions string
      Returns:
      a reference to this, so the API can be used fluently
    • isRead

      public boolean isRead()
      Is the file to opened for reading?
      Returns:
      true if to be opened for reading
    • setRead

      public OpenOptions setRead(boolean read)
      Set whether the file is to be opened for reading
      Parameters:
      read - true if the file is to be opened for reading
      Returns:
      a reference to this, so the API can be used fluently
    • isWrite

      public boolean isWrite()
      Is the file to opened for writing?
      Returns:
      true if to be opened for writing
    • setWrite

      public OpenOptions setWrite(boolean write)
      Set whether the file is to be opened for writing
      Parameters:
      write - true if the file is to be opened for writing
      Returns:
      a reference to this, so the API can be used fluently
    • isCreate

      public boolean isCreate()
      Should the file be created if it does not already exist?
      Returns:
      true if the file should be created if it does not already exist
    • setCreate

      public OpenOptions setCreate(boolean create)
      Set whether the file should be created if it does not already exist.
      Parameters:
      create - true if the file should be created if it does not already exist
      Returns:
      a reference to this, so the API can be used fluently
    • isCreateNew

      public boolean isCreateNew()
      Should the file be created if and the open fail if it already exists?
      Returns:
      true if the file should be created if and the open fail if it already exists.
    • setCreateNew

      public OpenOptions setCreateNew(boolean createNew)
      Set whether the file should be created and fail if it does exist already.
      Parameters:
      createNew - true if the file should be created or fail if it exists already
      Returns:
      a reference to this, so the API can be used fluently
    • isDeleteOnClose

      public boolean isDeleteOnClose()
      Should the file be deleted when it's closed, or the JVM is shutdown.
      Returns:
      true if the file should be deleted when it's closed or the JVM shutdown
    • setDeleteOnClose

      public OpenOptions setDeleteOnClose(boolean deleteOnClose)
      Set whether the file should be deleted when it's closed, or the JVM is shutdown.
      Parameters:
      deleteOnClose - whether the file should be deleted when it's closed, or the JVM is shutdown.
      Returns:
      a reference to this, so the API can be used fluently
    • isTruncateExisting

      public boolean isTruncateExisting()
      If the file exists and is opened for writing should the file be truncated to zero length on open?
      Returns:
      true if the file exists and is opened for writing and the file be truncated to zero length on open
    • setTruncateExisting

      public OpenOptions setTruncateExisting(boolean truncateExisting)
      Set whether the file should be truncated to zero length on opening if it exists and is opened for write
      Parameters:
      truncateExisting - true if the file should be truncated to zero length on opening if it exists and is opened for write
      Returns:
      a reference to this, so the API can be used fluently
    • isSparse

      public boolean isSparse()
      Set whether a hint should be provided that the file to created is sparse
      Returns:
      true if a hint should be provided that the file to created is sparse
    • setSparse

      public OpenOptions setSparse(boolean sparse)
      Set whether a hint should be provided that the file to created is sparse
      Parameters:
      sparse - true if a hint should be provided that the file to created is sparse
      Returns:
      a reference to this, so the API can be used fluently
    • isSync

      public boolean isSync()
      If true then every write to the file's content and metadata will be written synchronously to the underlying hardware.
      Returns:
      true if sync
    • setSync

      public OpenOptions setSync(boolean sync)
      Set whether every write to the file's content and meta-data will be written synchronously to the underlying hardware.
      Parameters:
      sync - true if sync
      Returns:
      a reference to this, so the API can be used fluently
    • isDsync

      public boolean isDsync()
      If true then every write to the file's content will be written synchronously to the underlying hardware.
      Returns:
      true if sync
    • setDsync

      public OpenOptions setDsync(boolean dsync)
      Set whether every write to the file's content will be written synchronously to the underlying hardware.
      Parameters:
      dsync - true if sync
      Returns:
      a reference to this, so the API can be used fluently
    • isAppend

      public boolean isAppend()
      Returns:
      true if the file should be opened in append mode, false otherwise
    • setAppend

      public OpenOptions setAppend(boolean append)
      Whether the file should be opened in append mode. Defaults to false.
      Parameters:
      append - true to open file in append mode, false otherwise
      Returns:
      a reference to this, so the API can be used fluently