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 635AF9FA5BA for ; Thu, 22 Jun 2006 13:55:18 -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 09163-04 for ; Thu, 22 Jun 2006 13:55:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 9DC0A9FA2F0 for ; Thu, 22 Jun 2006 13:55:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MGt97q001049; Thu, 22 Jun 2006 12:55:09 -0400 (EDT) To: "Michael Guyver" cc: pgsql-jdbc@postgresql.org Subject: Re: Binary tx format for an array? In-reply-to: <30b57570606220116h2f216c1eue74e5cfbb41bd5bc@mail.gmail.com> References: <30b57570606211026o66e337c9s658387db0b32aeed@mail.gmail.com> <17160.1150929667@sss.pgh.pa.us> <30b57570606220116h2f216c1eue74e5cfbb41bd5bc@mail.gmail.com> Comments: In-reply-to "Michael Guyver" message dated "Thu, 22 Jun 2006 09:16:32 +0100" Date: Thu, 22 Jun 2006 12:55:09 -0400 Message-ID: <1048.1150995309@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/95 X-Sequence-Number: 15375 "Michael Guyver" writes: > are the bytes representing an int4 Oid simply 23, represented in variable buf as > [0x17][0x00][0x00][0x00] No, in the buffer they'll be in network (big-endian) byte order, [0x00][0x00][0x00][0x17] If you are running in a little-endian architecture (eg Intel) then at some point you'll be wanting to reverse the byte order to make a native integer. In C you'd use ntohl() to do this. I'm not sure what's the 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. regards, tom lane