copy patch question: byte format and efficiency

From: Georg Hintermaier <georg_hintermaier(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: copy patch question: byte format and efficiency
Date: 2006-01-28 10:22:56
Message-ID: plgmt19tcfquvm9nvgjoun3amq03e58utc@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Georg Hintermaier 2006-01-29 00:14:38 Re: copy patch question: byte format and efficiency
Previous Message Philip Yarra 2006-01-28 03:13:54 Re: Postgres-JDBC question