Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22513

Re: offsets in a FileChannel ...

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: offsets in a FileChannel ...
Date Mon, 25 Feb 2013 21:50:18 +0100
Lines 33
Message-ID <ap214gF52mbU1@mid.individual.net> (permalink)
References <kgain5$4pl$1@speranza.aioe.org> <aos2kgFqnonU1@mid.individual.net> <2rkmi8hjbqisimmd7bcsalbqjs6f8l9ngp@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net I5fqLNU834WNt48+VXQ0eAbuN5J1bw0XxT49UA16xMCHp1Z88=
Cancel-Lock sha1:NAD11r/go7MKBdlgZwjdst1edUM=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
In-Reply-To <2rkmi8hjbqisimmd7bcsalbqjs6f8l9ngp@4ax.com>
Xref csiph.com comp.lang.java.programmer:22513

Show key headers only | View raw


On 25.02.2013 13:09, Roedy Green wrote:
> On Sat, 23 Feb 2013 15:39:08 +0100, Robert Klemme
> <shortcutter@googlemail.com> wrote, quoted or indirectly quoted
> someone who said :
>
>> UTF8 is not an encoding with a fixed width.
>
> You could use UTF-16.  Then you could interconvert 8 byte and char
> offsets. with a simple shift.

I don't.  And he don't either since UTF-16 isn't a fixed width encoding.
http://www.unicode.org/faq/utf_bom.html#gen6
http://www.unicode.org/versions/Unicode6.2.0/ch03.pdf#G28070

> You could build a table of interesting byte offsets when you construct
> the stream.

So you would augment the file with an index file.  This is certainly not 
a general solution as you do not always have the option to transport 
that extra data with the file.  Plus, aligning offsets while writing 
might prove as difficult as when reading (e.g. because of buffering).

> You could embed binary counts in bytes/chars at the head of phrases.
> You build and take the stream apart with ByteArrayStreams.

That's no longer a text document.

	robert


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

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

offsets in a FileChannel ... qwertmonkey@syberianoutpost.ru - 2013-02-23 14:11 +0000
  Re: offsets in a FileChannel ... Robert Klemme <shortcutter@googlemail.com> - 2013-02-23 15:39 +0100
    Re: offsets in a FileChannel ... Roedy Green <see_website@mindprod.com.invalid> - 2013-02-25 04:09 -0800
      Re: offsets in a FileChannel ... Robert Klemme <shortcutter@googlemail.com> - 2013-02-25 21:50 +0100
        Re: offsets in a FileChannel ... Roedy Green <see_website@mindprod.com.invalid> - 2013-02-26 08:05 -0800

csiph-web