Re: Binary tx format for an array? - Mailing list pgsql-jdbc

From Mark Lewis
Subject Re: Binary tx format for an array?
Date
Msg-id 1151003773.21238.13.camel@archimedes
Whole thread Raw
In response to Re: Binary tx format for an array?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Binary tx format for an array?
List pgsql-jdbc
> appropriate thing in Java --- I was under the impression that Java tried
> to hide hardware details like endianness, so there may be some
> convention about how you turn a sequence of bytes into a native integer.

Java tried so hard to hide endianness from you that it didn't provide
any real support for those times when you DO need to be aware of it.  So
the "convention" looks kind of like this (snipped from the PG JDBC
driver):

    public void SendInteger4(int val) throws IOException
    {
        SendChar((val >> 24)&255);
        SendChar((val >> 16)&255);
        SendChar((val >> 8)&255);
        SendChar(val&255);
    }

There finally were endian-aware buffer operations added in JDK 1.4, but
using them would be a big code change and would make the driver
unavailable for users of antique JVM's.

-- Mark

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: Binary tx format for an array?
Next
From: Sebastiaan van Erk
Date:
Subject: Re: Limit vs setMaxRows issue