• Post Reply Bookmark Topic Watch Topic
  • New Topic

RandomAccessFile, FileChannel, MappedByteBuffer...  RSS feed

 
christian bergmann
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

We have the following problem, which drives us insane.

We want to insert some text (with a given length) into a file at a given position, but we want that the content at this position will NOT be overwritten. Instead, we want to slide this content for the given length of the new insert "to the right".

We have a RandomAccessFile object. There we opened a FileChannel and from this one a MappedByteBuffer.

Our suggestion is the following: There are three parts:
1) The part which lies before the insert.
2) The insert itself
3) The part which lies after the insert and therefore had to be moved in order to keep it.

Any suggestions? Any ideas? Thanks in advance!
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. Have a look at:
JavaRanch FAQ: Edit an Existing File
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!