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 14FA49FB280 for ; Mon, 10 Jul 2006 06:20:03 -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 24454-10 for ; Mon, 10 Jul 2006 06:19:55 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 1DFED9FA502 for ; Mon, 10 Jul 2006 06:19:55 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Fzrvh-00028L-AL for pgsql-jdbc@postgresql.org; Mon, 10 Jul 2006 11:19:49 +0200 Received: from 83.145.96.118 ([83.145.96.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jul 2006 11:19:49 +0200 Received: from Marc.Herbert by 83.145.96.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jul 2006 11:19:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Marc Herbert Subject: java & endianness [Re: Binary tx format for an array?] Date: Mon, 10 Jul 2006 11:19:44 +0200 Lines: 36 Message-ID: References: <30b57570606211026o66e337c9s658387db0b32aeed@mail.gmail.com> <17160.1150929667@sss.pgh.pa.us> <30b57570606220116h2f216c1eue74e5cfbb41bd5bc@mail.gmail.com> <1048.1150995309@sss.pgh.pa.us> <1151003773.21238.13.camel@archimedes> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 83.145.96.118 User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:8GQeAo9mipHL1/tLoo4yDFQhOZE= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/24 X-Sequence-Number: 15450 Mark Lewis writes: > 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. Could you give sample cases when you DO need it? I don't think that many people write hardware drivers in Java ;-) I don't think network communication qualifies either, see below. > 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); > } This code is like copied/pasted from the JDK: * @since JDK1.0 DataOutputStream#writeInt() Any reason for duplicating it in the driver? > There finally were endian-aware buffer operations added in JDK 1.4, Could you detail which ones? Thanks in advance.