Обсуждение: copy patch question: byte format and efficiency

Поиск
Список
Период
Сортировка

copy patch question: byte format and efficiency

От
Georg Hintermaier
Дата:
Hi,
I am trying to stream selected columns of a file into the database.
I am reading the file in with a BufferedReader wrapped FileReader.
In a class implementing the InputStream interface I am filtering
out the columns I like (to my luck only ints and floats) and write
them into a ByteBuffer.

The problem I discovered is that the format of the ByteBuffer
is very different from the format that is used and works e.g.
in the unit tests used in the copy patch.

There the data is encoded into a ByteArrayOutputStream via a
PrintStream and the ResultingByteArray is used in the constructor
of an InputStream.

Questions:
Am I on the right track in general or is there a more efficient way?
I was also thinking about subclassing FilterInputStream, but
then I would have to construct the ints and floats myself.

How can I encode the ints and floats into the byteArray (or a
different buffer) in an efficient way in the correct format?

thanks
georg

Re: copy patch question: byte format and efficiency

От
Georg Hintermaier
Дата:
On Sat, 28 Jan 2006 11:22:56 +0100, Georg Hintermaier
<georg_hintermaier@yahoo.com> wrote:

>Hi,
>I am trying to stream selected columns of a file into the database.

>Questions:
>Am I on the right track in general or is there a more efficient way?
>I was also thinking about subclassing FilterInputStream, but
>then I would have to construct the ints and floats myself.

This works now very well and its very simple.
georg