Re: Binary tx format for an array?

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Guyver <kenevel(at)googlemail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Binary tx format for an array?
Date: 2006-06-22 19:16:13
Message-ID: 1151003773.21238.13.camel@archimedes
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sebastiaan van Erk 2006-06-22 20:14:12 Re: Limit vs setMaxRows issue
Previous Message Tom Lane 2006-06-22 16:55:09 Re: Binary tx format for an array?