[Pljava-dev] readBytes() / writeBytes()

From: schabi at logix-tt(dot)com (Markus Schaber)
To:
Subject: [Pljava-dev] readBytes() / writeBytes()
Date: 2006-09-22 08:38:31
Message-ID: 4513A107.4060809@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi, Thomas,

Thomas Hallgren wrote:

>> I just stumbled about the readBytes() / writeBytes() methods from
>> SQLInputFromChunk / SQLOutputFromChunk classes.
>>
>> They seem to assume that every array has a 2-byte length header.
>>
> Those classes are part of the JNI interface. They map to the internal
> PostgreSQL StringInfo structure. They are *not* intended for any other use.

Ok, it seems I've been mislead by reading the docs and source, sorry.
Please tell me, what's their use, if not implementing datatype mappings?

As far as I can see, they're the only implementations of the
SQLInput/ SQLOutput interfaces one uses to implement a custom data type.

So, when mapping a datatype (like the ComplexTuple example delivered
with pljava), one is actually using those classes.

And as the storage format of the PostGIS datatypes is determined by the
C implementation in liblwgeom.so, I have to adhere to that format.

I have to understand how SQLInputFromChunk and SQLOutputFromChunk
work, to find the most efficient implementation while still being
compatible to that predefined binary format.

As it looks now, my only possibility seems to find out the native
endianness of the machine, and then read the data byte-for-byte via
readByte(), and then put it together for myself. Most of the code should
be copyable from the WKB parsers I've already written, so no real
effort, but I'm still afraid that calling a native function per byte
will not perform best.

Thanks for your patience,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20060922/38121583/attachment.bin>

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Markus Schaber 2006-09-22 08:48:49 [Pljava-dev] readBytes() / writeBytes()
Previous Message Thomas Hallgren 2006-09-22 08:22:34 [Pljava-dev] Best way to pass intermediate state