Java Program to Read Text From File From a Specified Index
In a file system, without reading the previous text we cannot directly access the specific index. Thus, Reading text from a file from the specific index is achieved by skipping all the previous characters of a specified index. To read text from an index n, we need to skip (n-1) bytes. Here, we will use FileInputStream class to read text from the file.
long skip(long n): Skips over and discards n bytes of data from the input stream.
public long skip(long n) throws IOException
Parameters: n — the number of bytes to be skipped.
Returns: The actual number of bytes skipped.