pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc Herbert <Marc.Herbert@continuent.com>
To: pgsql-jdbc@postgresql.org
Subject: java & endianness [Re: Binary tx format for an array?]
Date: Mon, 10 Jul 2006 11:19:44 +0200
Message-ID: <khjac7h3jgv.fsf_-_@meije.emic.fr> (raw)
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>

Mark Lewis <mark.lewis@mir3.com> 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.





view thread (4+ messages)  latest in thread

Message-ID: <khjac7h3jgv.fsf_-_@meije.emic.fr>
Permalink:  ../khjac7h3jgv.fsf_-_@meije.emic.fr/
Also on:    postgresql.org/message-id/khjac7h3jgv.fsf_-_@meije.emic.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: Marc.Herbert@continuent.com
  Subject: Re: java & endianness [Re: Binary tx format for an array?]
  In-Reply-To: <khjac7h3jgv.fsf_-_@meije.emic.fr>
  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> <khjac7h3jgv.fsf_-_@meije.emic.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox