X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D6D299FB0D1 for ; Thu, 22 Jun 2006 16:16:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 27609-10 for ; Thu, 22 Jun 2006 16:16:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 1175B9FA2F0 for ; Thu, 22 Jun 2006 16:16:17 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 22 Jun 2006 12:16:13 -0700 Subject: Re: Binary tx format for an array? From: Mark Lewis To: Tom Lane Cc: Michael Guyver , pgsql-jdbc@postgresql.org In-Reply-To: <1048.1150995309@sss.pgh.pa.us> References: <30b57570606211026o66e337c9s658387db0b32aeed@mail.gmail.com> <17160.1150929667@sss.pgh.pa.us> <30b57570606220116h2f216c1eue74e5cfbb41bd5bc@mail.gmail.com> <1048.1150995309@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Thu, 22 Jun 2006 12:16:13 -0700 Message-Id: <1151003773.21238.13.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/96 X-Sequence-Number: 15376 > 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