Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

ObjectInputStream/OutputStream buffering?

Thread view: 
Knute Johnson - 18 Feb 2007 22:02 GMT
Are ObjectInputStream and ObjectOutputStream buffered?  Normally if you
use a BufferedInputStream it is the last stream class in the list.  Can
you put a BufferedInputStream between the InputStream and
ObjectInputStream and realize any performance improvement?

Thanks,

Signature

Knute Johnson
email s/nospam/knute/

petersprc - 18 Feb 2007 23:20 GMT
These are not buffered, so using a BufferedStream may be useful if
doing a large amount of I/O.

(Note, when creating an ObjectOutputStream:
"callers may wish to flush the stream immediately to ensure that
constructors for receiving ObjectInputStreams will not block when
reading the header.")

(In certain edge cases, you may want to flush the ObjectOutputStream,
see

On Feb 18, 5:02 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> Are ObjectInputStream and ObjectOutputStream buffered?  Normally if you
> use a BufferedInputStream it is the last stream class in the list.  Can
[quoted text clipped - 7 lines]
> Knute Johnson
> email s/nospam/knute/
Knute Johnson - 18 Feb 2007 23:55 GMT
> These are not buffered, so using a BufferedStream may be useful if
> doing a large amount of I/O.
[quoted text clipped - 20 lines]
>> Knute Johnson
>> email s/nospam/knute/

I tried it with a file and it does improve the I/O considerable but
where I really wanted to use it was with some network I/O.  When the
input side was buffered it didn't read all of the data and hung.  That
turns out not to be where my problem was anyway so I put it back to
unbuffered.  Thanks for the post.

Signature

Knute Johnson
email s/nospam/knute/

Esmond Pitt - 19 Feb 2007 00:47 GMT
> I tried it with a file and it does improve the I/O considerable but
> where I really wanted to use it was with some network I/O.  When the
> input side was buffered it didn't read all of the data and hung.  That
> turns out not to be where my problem was anyway so I put it back to
> unbuffered.

Buffering on a network is still a good idea. The problem you had was
that the other end wasn't flushing at the appropriate times.
petersprc - 19 Feb 2007 01:51 GMT
Yeah, as Esmond says, the issue seems to be the case considered in
this report:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4337145

Flushing after creating the ObjectOutputStream might do the trick.

On Feb 18, 7:47 pm, Esmond Pitt <esmond.p...@nospam.bigpond.com>
wrote:
> > I tried it with a file and it does improve the I/O considerable but
> > where I really wanted to use it was with some network I/O.  When the
[quoted text clipped - 4 lines]
> Buffering on a network is still a good idea. The problem you had was
> that the other end wasn't flushing at the appropriate times.
Knute Johnson - 19 Feb 2007 02:39 GMT
> Yeah, as Esmond says, the issue seems to be the case considered in
> this report:
[quoted text clipped - 12 lines]
>> Buffering on a network is still a good idea. The problem you had was
>> that the other end wasn't flushing at the appropriate times.

That could have been the problem, I'll have to play with is some more.

Thanks,

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.