Answer the question
In order to leave comments, you need to log in
ByteBuffer read-only?
I am learning Java from the book Thinking in Java.
It has this suggestion:
To restrict file access to read -only , explicitly obtain a ByteBuffer using the allocate() static method
...
fc = new FileOutputStream("data2.txt").getChannel();
buffer = ByteBuffer.allocate(24);
buffer.asCharBuffer().put("Some text");
fc.write(buffer);
fc.close();
...
Answer the question
In order to leave comments, you need to log in
I suggest reading the documentation and everything will fall into place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question