Question

I use java 6 method readByte() from class randomAccessFile to read text files on linux x64.

I'm looking the end of text line by finding

 "0xD" or "0xA" 

at the end.

My question is : in case operating system will switch to x32 , will the find still work ?

Maybe better to find characters at the end of text line , like

 "\n" 

and not bytes ?

Was it helpful?

Solution

Whether you use a 64-bit JVM or a 32-bit JVM the contents of the file don't change so you are looking for the same thing. RandomAccessFile is designed for binary files and so you can only read bytes, not characters. You have to do the translation from bytes to characters.

In short, you read the same bytes in either case and talking about characters is just down to how you see them as characters, only bytes are meaningful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top