M
mytkdd
hi, everyone,
i used to use RandomAccessFile.setLength() to truncate the file from a
given postion, for example, from "abcdeabcde" to "abcde" .
but if i map a region of this file into memory using
RandomAccessFile.getFileChannel() and FileChannel.map() while i am
dealing with large file for example 2GB, the api can not work. The
runtime error shows this method can not work while using memory
mapping, even i close and open a new RandomAccessFile object or clear
the MappedByteBuffer object.
Now i don't know how to truncate the file while using memory
mapping.Does anyone konw how?
thanks in advance.
tkdd
i used to use RandomAccessFile.setLength() to truncate the file from a
given postion, for example, from "abcdeabcde" to "abcde" .
but if i map a region of this file into memory using
RandomAccessFile.getFileChannel() and FileChannel.map() while i am
dealing with large file for example 2GB, the api can not work. The
runtime error shows this method can not work while using memory
mapping, even i close and open a new RandomAccessFile object or clear
the MappedByteBuffer object.
Now i don't know how to truncate the file while using memory
mapping.Does anyone konw how?
thanks in advance.
tkdd