org.apache.commons.io

## Class RandomAccessFiles

- java.lang.Object
- - org.apache.commons.io.RandomAccessFiles

-     public class RandomAccessFiles
      extends Object

  Works on RandomAccessFile.
  Since:
    2.13.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomAccessFiles()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `read(RandomAccessFile input, long position, int length)` Reads a byte array starting at "position" for "length" bytes.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RandomAccessFiles

          public RandomAccessFiles()

  - ### Method Detail

    - #### read

          public static byte[] read(RandomAccessFile input,
                                    long position,
                                    int length)
                             throws IOException

      Reads a byte array starting at "position" for "length" bytes.
      Parameters:
        `input` - The source RandomAccessFile.
        `position` - The offset position, measured in bytes from the beginning of the file, at which to set the file pointer.
        `length` - How many bytes to read.
      Returns:
        a new byte array.
      Throws:
        `IOException` - If the first byte cannot be read for any reason other than end of file, or if the random access file has been closed, or if some other I/O error occurs.

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.