Could you please explain me what is a BufferedStream (what is a buffer and how it should be used?)? I have used a code that uses bufferedstream to write to a .txt file. I got the code while googling but don't know the theory behind how it works... please explain.
I have gone through the tutorials... Thanks for the link... But i never understood the meaning of buffer(I am sure there is a logic behind its being called as "BufferStreams" and not anything else..)
Does it mean that using BufferedStreams should always be preferred over using unbuffered streams as we don't have to call upon the native API many times for reading and writing.. is there any particular example where unbuffered streams are preferred over buffered streams..?
Use unbuffered output streams when you want each write to be processed immediately - eg Writing a log file - you don't want the last few messages to be lost when the program crashes and the buffer is lost. Another eg - writing to a network stream to send chat messages to another PC - you want each message to be sent immediately, you don't want them stored up until there is a complete buffer-full to be sent.
I can't think of any cases where you would prefer an unbuffered input stream
oh.. thanks a lot James, Stultuske... i am learning a lot from you guys... i think i will be a decent programmer in 4-5 months if i could keep in touch with you guys and keep learning from you... Thanks :)