Class ReadWriteFileParams

Object
ReadWriteFileParams

public class ReadWriteFileParams
extends Object
A set of parameters used to hand over to the 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.
  • Method Details

    • setPath

      public static ReadWriteFileParams.Builder setPath​(Path path)
      Since ReadWriteFileParams uses the Builder pattern with a mandatory path 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 a ReadWriteFileParams object, call the build() method of the builder when all optional chaining has been done.
      Parameters:
      path - Path: The file to be read from or written to. Providing a file path is mandatory.
      Returns:
      The instance object of this class, with a mandatory file path set, and further optional fields set from Builder chaining.
      Since:
      1.00
    • getData

      public byte[] getData()
      Returns the buffer holding the data from/for readFile and writeFile methods.

      When using the writeFile method, providing a data buffer (and data accordingly, logically) is mandatory.
      In contrast, when using the readFile method, providing a data buffer is optional.
      If readFile 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.
      If readFile method is called without providing a data buffer i.e. when getData() equals null, the method call will dynamically allocate a buffer holding the data being read.

      Returns:
      Array of Bytes: The buffer holding the data to be read or written, or null if no buffer is provided.
      Since:
      1.00
    • getDataOffset

      public int getDataOffset()
      Returns the Offset inside the Data Buffer at which read/write Operations start
      Returns:
      int: The Offset inside the Data 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

      public List<OpenOption> getOptions()
      Returns the OpenOptions used for the read/write file operations.
      Returns:
      List of OpenOptions: The OpenOptions used for the read/write file operations.
    • getPath

      public Path getPath()
      Returns the Path used for the read/write file operations.
      Returns:
      Path: The Path 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