copy patch question: byte format and efficiency

Поиск
Список
Период
Сортировка
От Georg Hintermaier
Тема copy patch question: byte format and efficiency
Дата
Msg-id plgmt19tcfquvm9nvgjoun3amq03e58utc@4ax.com
обсуждение исходный текст
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Philip Yarra
Дата:
Сообщение: Re: Postgres-JDBC question
Следующее
От: Georg Hintermaier
Дата:
Сообщение: Re: copy patch question: byte format and efficiency