Results 1 to 6 of 6
Thread: BufferedInputStream
- 08-22-2011, 12:58 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
BufferedInputStream
Hello!
I'm new to Java and I'm trying to understand how a BufferedInputStream works. I understand the underlying principle but I still have some questions.
1. Can I control the size of the buffer?
2. When exactly do the system calls occur? After I read all the values in the buffer, or at specific time intervals?
3. Can I perform any operations on the values stored in the buffer or should I copy them into an array, perform the operations and then copy the new values into a BufferedOutputStream?
Thank you!
- 08-22-2011, 01:35 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
1. Yes, look at one of the constructors for the BufferedInputStream class.
2. A system call occurs when the buffer is empty and the BufferedInputStream object needs to produce at least one new character.
3. The buffer is owned by a BufferedInputStream object and is of no concern to us (we can't even reach it in an orderly manner).
Since a BufferedInputStream object wraps another InputStream, the wrapped InputStream may do its own buffering.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 08-22-2011, 01:38 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Thanks a lot!
- 08-30-2011, 11:39 AM #4
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
One more question
.gif)
Is there a method to find out when my BufferedOutputStream is full? (Because I want to know when to call flush() )
- 08-30-2011, 12:37 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
The BufferredOutputStream takes care of it (if the buffer is full, it flushes it); you can call flush() on that output stream and it will flush the buffer (whatever is in it).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 08-30-2011, 12:58 PM #6
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
BufferedInputStream with Huffman Compression
By Msnforum in forum New To JavaReplies: 0Last Post: 11-03-2009, 09:04 PM -
Help with BufferedInputstream and/or DataInputStream
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:16 AM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks