Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > offsets in a FileChannel ...

Reply
Thread Tools

offsets in a FileChannel ...

 
 
qwertmonkey@syberianoutpost.ru
Guest
Posts: n/a
 
      02-23-2013
> ... You would have to create more complex code if you want to align char
position and byte position.
~
but then why do they have a:
~
docs/api/java/nio/channels/FileChannel.html#position()
~
in the API? How/What is it used for?
~
If you read the FileChannel.position() as you read off the chars from the
CharBuffer you always get 0 (as if the offset pointer in the underlying
FileChannel would not advance)
~
I am using:
~
$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode)
~
lbrtchx
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      02-23-2013
On 23.02.2013 15:54, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>> ... You would have to create more complex code if you want to align char

> position and byte position.
> ~
> but then why do they have a:
> ~
> docs/api/java/nio/channels/FileChannel.html#position()
> ~
> in the API? How/What is it used for?


http://docs.oracle.com/javase/7/docs...html#position()

> ~
> If you read the FileChannel.position() as you read off the chars from the
> CharBuffer you always get 0 (as if the offset pointer in the underlying
> FileChannel would not advance)


Probably because you are not reading through the channel but mapping the
file into memory.

Please stop ripping your posting threads apart. Thank you.

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
offsets in a FileChannel ... qwertmonkey@syberianoutpost.ru Java 4 02-26-2013 04:05 PM
offsets in a FileChannel ... qwertmonkey@syberianoutpost.ru Java 0 02-23-2013 03:36 PM
Best way to get a few bytes from a java.nio.FileChannel'ed file... Spendius Java 0 09-07-2003 11:37 AM
Re: FileChannel.map() gives 'cannot allocate memory' Roedy Green Java 3 08-14-2003 08:44 PM
How come 'FileChannel.map()' returns a DirectByteBufferR ?... Spendius Java 4 07-03-2003 11:23 PM



Advertisments