Class ReadWriteFileParams
public class ReadWriteFileParams extends Object
readFile
and writeFile
methods of the CASIO Enterprise Developer Tools
Since readFile
and writeFile
methods use a variable set of parameters with overlapping parameter types, overloading methods or using variable argument lists isn't feasible.
Instead, instances of this class hold sets of all required parameters for these methods.
Use ReadWriteFileParams.Builder
to create new instances.
- Since:
- 1.00
- API Note:
- Requires Android O (Android 8) or later.
Using the ReadWriteFileParams class on a device running an earlier version of Android is useless since any method using this class is supported on Android O (Android 8) or later only.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReadWriteFileParams.Builder
Provides a convenient way to set the fields of aReadWriteFileParams
object when creating a new instance, following the Builder pattern. -
Method Summary
Modifier and Type Method Description byte[]
getData()
int
getDataOffset()
Returns the Offset inside theData Buffer
at which read/write Operations startint
getFileOffset()
Returns the File Offset at which read/write Operations startint
getLength()
Returns the Length of Data to be read or writtenList<OpenOption>
getOptions()
Returns theOpenOptions
used for the read/write file operations.Path
getPath()
Returns thePath
used for the read/write file operations.void
newData(int newDataLength)
Creates a new buffer holding the data to be read or writtenstatic ReadWriteFileParams.Builder
setPath(Path path)
Since ReadWriteFileParams uses the Builder pattern with a mandatorypath
field, there's no public constructor available.
Instead, this method is used to create a new instance of the Builder of this class.
In order to finally instantiate aReadWriteFileParams
object, call thebuild()
method of the builder when all optional chaining has been done.
-
Method Details
-
setPath
Since ReadWriteFileParams uses the Builder pattern with a mandatorypath
field, there's no public constructor available.
Instead, this method is used to create a new instance of the Builder of this class.
In order to finally instantiate aReadWriteFileParams
object, call thebuild()
method of the builder when all optional chaining has been done. -
getData
public byte[] getData()Returns the buffer holding the data from/forreadFile
andwriteFile
methods.When using the
writeFile
method, providing a data buffer (and data accordingly, logically) is mandatory.
In contrast, when using thereadFile
method, providing a data buffer is optional.
IfreadFile
method is called with a data buffer provided, the method call will fail if the data buffer is insufficient to hold the data being read.
IfreadFile
method is called without providing a data buffer i.e. when getData() equalsnull
, the method call will dynamically allocate a buffer holding the data being read. -
getDataOffset
public int getDataOffset()Returns the Offset inside theData Buffer
at which read/write Operations start- Returns:
int
: The Offset inside theData Buffer
at which read/write Operations start
-
getFileOffset
public int getFileOffset()Returns the File Offset at which read/write Operations start- Returns:
int
: The File Offset at which read/write Operations start
-
getLength
public int getLength()Returns the Length of Data to be read or written- Returns:
int
: The Length of Data to be read or written
-
getOptions
Returns theOpenOptions
used for the read/write file operations.- Returns:
List
ofOpenOptions
: TheOpenOptions
used for the read/write file operations.
-
getPath
Returns thePath
used for the read/write file operations. -
newData
public void newData(int newDataLength)Creates a new buffer holding the data to be read or written- Parameters:
newDataLength
-int
: The size of the new buffer holding the data to be read or written- Since:
- 1.00
-