From: | Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | java & endianness [Re: Binary tx format for an array?] |
Date: | 2006-07-10 09:19:44 |
Message-ID: | khjac7h3jgv.fsf_-_@meije.emic.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Mark Lewis <mark(dot)lewis(at)mir3(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Curi | 2006-07-10 13:35:28 | Encod again |
Previous Message | Marc Herbert | 2006-07-10 09:06:15 | Re: Limit vs setMaxRows issue |