true stream optimizing needs subclassing java.io.InputStream - Mailing list pgsql-jdbc

From Michael Adler
Subject true stream optimizing needs subclassing java.io.InputStream
Date
Msg-id Pine.NEB.4.44.0206271317140.10295-100000@reva.sixgirls.org
Whole thread Raw
In response to Re: DBVisualizer Null Pointer Exception  (Robert Treat <rtreat@webmd.net>)
List pgsql-jdbc
This continues the discussion of optimizing the reading of characters from
the backend.

From what I can tell, PG_Stream.ReceiveChar() is no less efficient
(approximately) than PG_Stream.Receive(byte[] b, int off, int length). The
later is simply a wrapper around InputStream's method read(b,off,len). My
test showed little or no difference between the two methods. We would need
to override read(b,off,len) for true improvements.

from java.io.InputStream:

<snip>

 The read(b, off, len) method for class InputStream simply calls the
method read() repeatedly. If the first such call results in an
IOException, that exception is returned from the call to the read(b,
off, len) method. If any subsequent call to read() results in a
IOException, the exception is caught and treated as if it were end of
file; the bytes read up to that point are stored into b and the number
of bytes read before the exception occurred is returned. Subclasses are
encouraged to provide a more efficient implementation of this method.

</snip>

I still have to test this over a modem. The high latency may demonstrate
the benefits of buffering.


Mike




pgsql-jdbc by date:

Previous
From: "Tim Lucia"
Date:
Subject: Re: Interrupt execution
Next
From: "Konstantinos Spyropoulos"
Date:
Subject: Re: Problem with JDBC: no suitable driver