Re: Binary tx format for an array?

Поиск
Список
Период
Сортировка
От Mark Lewis
Тема Re: Binary tx format for an array?
Дата
Msg-id 1151003773.21238.13.camel@archimedes
обсуждение исходный текст
Ответ на Re: Binary tx format for an array?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Binary tx format for an array?  ("Michael Guyver" <kenevel@googlemail.com>)
Список pgsql-jdbc
> 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Binary tx format for an array?
Следующее
От: Sebastiaan van Erk
Дата:
Сообщение: Re: Limit vs setMaxRows issue