I am trying to store a list of numbers(bytes) into a file so that I can retrieve them into a byte[].
59 20 60 21 61 22 62 23 63 24 64 25 65 26 66 27 67 28 68 29
67 30 66 31 65 32 64 33 63 34 62 35 61 36 60 37 59 38
66 29 65 30 64 31 63 32 62 33 61 34 60 35 59 36 58 37
65 28 64 29 63 30 62 31 61 32 60 33 59 34 58 35 57 36...
I have tried saving them into a text file but the relevant code doesn't seem to read it properly.
try {
File f = new File("cube_mapping2.txt");
array = new byte[file.size()]
FileInputStream stream = new FileInputStream(f);
stream.read(array);
} catch (Exception e) {
e.printStackTrace();
}
Is there a proper way to save the file so that FileInputReader.read(byte[] buffer) will populate the array with my bytes?
FileOutputStream.write(byte[])without converting them and read them back using your code above.