Question about RandomAccessFile and MappedByteBuffer

About RandomAccessFile's pointer.
Lets say I have 5 int values in a text file. I want to the 2nd int in my java program.
Then I jump 4 bytes forward (x.seek (4))(the pointer start at 0), because a int is equal to 4 byte.
If its a long value, I jump 8 byte forward, and so on for the rest of the primitive types.
But what about String, how do I do here? I dont get it....

MappedByteBuffer(mixed up with FileChannel and RandomAccessFile), this one is fast as hell when it comes to writing and reading to file. But I cant find any method that allow it to read/write strings. Am I out of options or is there an other way to do it?

Strings could be stored as single byte/letter for some character sets. You will need to know the length of the String to be able to skip over it.
If you are writing the file, you could write a field, say a short, with the length of the String followed by the String characters. Read the short to get the length to skip.

The pointer won't be at s. It will at some position in your file. How do you know where the pointer is in the file? How do you know if the word(s) at the current pointer position are the words you want to skip?

Lets start from start.
I write a string and an int to a fileX with RandomAccessFile.
I create a new program that read fileX with RandomAccessFile.
The position start at 0, thats where the string is, I dont want to read it, I want to read the int. That means I must move the pointer behind the string, then I can read the int. The question is, how long should I move the pointer?

Move the pointer the number of bytes in the String. If its an ASCII String then the number of bytes will be the same as the length of the String. What format is the int in? Is it a 4 byte binary number or is it character digits?

As the subtle replies so far are trying to point out, you have no idea unless you know what the string is that you want to skip. How about you drop the RandomAccessFile path and try using a normal reader such as FileReader or Scanner. Then read the entire line into your program where you can then manipulate it. Such as using a regular expression. Or maybe if the data in the original file was in a known organisational structure such as a CSV. This would make it easier to know where the actual data you want is located on each line.

Move the pointer the number of bytes in the String. If its an ASCII String then the number of bytes will be the same as the length of the String. What format is the int in? Is it a 4 byte binary number or is it character digits?

int is in a 4 byte binary. RandomAccessFile always print in binary form.
Also how do I know the number of bytes in a string? and how do I know if its an ASCII? btw ASCII is standard right? or is ANSI standard?

As Junky pointed out, are the Strings always the same length. The first one is 5 bytes, then the next one is 8 etc
Or can they be of unknown lengths. The contents of the file must be in fixed positions always or the program will not read the correct bytes.

RandomAccessFile always print in binary form

What do you mean by "print"? I don't see a print() method for the RandomAccessFile class.