I'm doing a project where I my code has to be the most efficient possible, and I need to read ascii chars and ints from a file. The problem (I think) is that when I read chars it reads in UTF8 beacuse it only reads half the times it should.

I tried with DataInputStream but it doesnt work. Also I check the RandomAccessFile but it reads in UTF8. The Scanner throws an InputMismatchException when I tried to read two bytes and convert them to char.

Is it that the only option is to do this by hand?

Thanks in advance