Class OpenOptions
java.lang.Object
io.vertx.core.file.OpenOptions
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanWhether the file should be opened in append mode by default = false.static final booleanstatic final booleanstatic final booleanstatic final booleanstatic final Stringstatic final booleanstatic final booleanstatic final booleanstatic final booleanstatic final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorOpenOptions(OpenOptions other) Copy constructorOpenOptions(JsonObject json) Constructor to create options from JSON -
Method Summary
Modifier and TypeMethodDescriptiongetPerms()Get the permissions string to be used if creating a filebooleanisAppend()booleanisCreate()Should the file be created if it does not already exist?booleanShould the file be created if and the open fail if it already exists?booleanShould the file be deleted when it's closed, or the JVM is shutdown.booleanisDsync()If true then every write to the file's content will be written synchronously to the underlying hardware.booleanisRead()Is the file to opened for reading?booleanisSparse()Set whether a hint should be provided that the file to created is sparsebooleanisSync()If true then every write to the file's content and metadata will be written synchronously to the underlying hardware.booleanIf the file exists and is opened for writing should the file be truncated to zero length on open?booleanisWrite()Is the file to opened for writing?setAppend(boolean append) Whether the file should be opened in append mode.setCreate(boolean create) Set whether the file should be created if it does not already exist.setCreateNew(boolean createNew) Set whether the file should be created and fail if it does exist already.setDeleteOnClose(boolean deleteOnClose) Set whether the file should be deleted when it's closed, or the JVM is shutdown.setDsync(boolean dsync) Set whether every write to the file's content will be written synchronously to the underlying hardware.Set the permissions stringsetRead(boolean read) Set whether the file is to be opened for readingsetSparse(boolean sparse) Set whether a hint should be provided that the file to created is sparsesetSync(boolean sync) Set whether every write to the file's content and meta-data will be written synchronously to the underlying hardware.setTruncateExisting(boolean truncateExisting) Set whether the file should be truncated to zero length on opening if it exists and is opened for writesetWrite(boolean write) Set whether the file is to be opened for writing
-
Field Details
-
DEFAULT_PERMS
-
DEFAULT_READ
public static final boolean DEFAULT_READ- See Also:
-
DEFAULT_WRITE
public static final boolean DEFAULT_WRITE- See Also:
-
DEFAULT_CREATE
public static final boolean DEFAULT_CREATE- See Also:
-
DEFAULT_CREATENEW
public static final boolean DEFAULT_CREATENEW- See Also:
-
DEFAULT_DSYNC
public static final boolean DEFAULT_DSYNC- See Also:
-
DEFAULT_SYNC
public static final boolean DEFAULT_SYNC- See Also:
-
DEFAULT_DELETEONCLOSE
public static final boolean DEFAULT_DELETEONCLOSE- See Also:
-
DEFAULT_TRUNCATEEXISTING
public static final boolean DEFAULT_TRUNCATEEXISTING- See Also:
-
DEFAULT_SPARSE
public static final boolean DEFAULT_SPARSE- See Also:
-
DEFAULT_APPEND
public static final boolean DEFAULT_APPENDWhether the file should be opened in append mode by default = false.- See Also:
-
-
Constructor Details
-
OpenOptions
public OpenOptions()Default constructor -
OpenOptions
-
OpenOptions
Constructor to create options from JSON- Parameters:
json- the JSON
-
-
Method Details
-
getPerms
Get the permissions string to be used if creating a file- Returns:
- the permissions string
-
setPerms
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
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
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
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
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
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
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
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
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
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
Whether the file should be opened in append mode. Defaults tofalse.- Parameters:
append- true to open file in append mode, false otherwise- Returns:
- a reference to this, so the API can be used fluently
-