Package io.vertx.core.file
Class OpenOptions
- java.lang.Object
-
- io.vertx.core.file.OpenOptions
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_APPENDWhether the file should be opened in append mode by default = false.static booleanDEFAULT_CREATEstatic booleanDEFAULT_CREATENEWstatic booleanDEFAULT_DELETEONCLOSEstatic booleanDEFAULT_DSYNCstatic StringDEFAULT_PERMSstatic booleanDEFAULT_READstatic booleanDEFAULT_SPARSEstatic booleanDEFAULT_SYNCstatic booleanDEFAULT_TRUNCATEEXISTINGstatic booleanDEFAULT_WRITE
-
Constructor Summary
Constructors Constructor Description OpenOptions()Default constructorOpenOptions(OpenOptions other)Copy constructorOpenOptions(JsonObject json)Constructor to create options from JSON
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPerms()Get the permissions string to be used if creating a filebooleanisAppend()booleanisCreate()Should the file be created if it does not already exist?booleanisCreateNew()Should the file be created if and the open fail if it already exists?booleanisDeleteOnClose()Should 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.booleanisTruncateExisting()If 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?OpenOptionssetAppend(boolean append)Whether the file should be opened in append mode.OpenOptionssetCreate(boolean create)Set whether the file should be created if it does not already exist.OpenOptionssetCreateNew(boolean createNew)Set whether the file should be created and fail if it does exist already.OpenOptionssetDeleteOnClose(boolean deleteOnClose)Set whether the file should be deleted when it's closed, or the JVM is shutdown.OpenOptionssetDsync(boolean dsync)Set whether every write to the file's content will be written synchronously to the underlying hardware.OpenOptionssetPerms(String perms)Set the permissions stringOpenOptionssetRead(boolean read)Set whether the file is to be opened for readingOpenOptionssetSparse(boolean sparse)Set whether a hint should be provided that the file to created is sparseOpenOptionssetSync(boolean sync)Set whether every write to the file's content and meta-data will be written synchronously to the underlying hardware.OpenOptionssetTruncateExisting(boolean truncateExisting)Set whether the file should be truncated to zero length on opening if it exists and is opened for writeOpenOptionssetWrite(boolean write)Set whether the file is to be opened for writing
-
-
-
Field Detail
-
DEFAULT_PERMS
public static final String DEFAULT_PERMS
-
DEFAULT_READ
public static final boolean DEFAULT_READ
- See Also:
- Constant Field Values
-
DEFAULT_WRITE
public static final boolean DEFAULT_WRITE
- See Also:
- Constant Field Values
-
DEFAULT_CREATE
public static final boolean DEFAULT_CREATE
- See Also:
- Constant Field Values
-
DEFAULT_CREATENEW
public static final boolean DEFAULT_CREATENEW
- See Also:
- Constant Field Values
-
DEFAULT_DSYNC
public static final boolean DEFAULT_DSYNC
- See Also:
- Constant Field Values
-
DEFAULT_SYNC
public static final boolean DEFAULT_SYNC
- See Also:
- Constant Field Values
-
DEFAULT_DELETEONCLOSE
public static final boolean DEFAULT_DELETEONCLOSE
- See Also:
- Constant Field Values
-
DEFAULT_TRUNCATEEXISTING
public static final boolean DEFAULT_TRUNCATEEXISTING
- See Also:
- Constant Field Values
-
DEFAULT_SPARSE
public static final boolean DEFAULT_SPARSE
- See Also:
- Constant Field Values
-
DEFAULT_APPEND
public static final boolean DEFAULT_APPEND
Whether the file should be opened in append mode by default = false.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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 tofalse.- Parameters:
append- true to open file in append mode, false otherwise- Returns:
- a reference to this, so the API can be used fluently
-
-