java - Why there is a confilict between what you see open a file and what input by ByteBuffer -
for(int i=0; i<10; i++){ array[i] = (char)('a'+i); } randomaccessfile rf = new randomaccessfile("data1.txt", "rw"); filechannel fc = rf.getchannel(); bytebuffer buffer = null; buffer = bytebuffer.allocate(1024); for(int i=0; i<10; i++){ buffer.putint((int) array[i]); } buffer.flip(); fc.write(buffer);
above code, try write 97,98...into file , when read bytebuffer , print screen appears 97,98,...
but when open file appears a,b,c.....
why
Comments
Post a Comment