• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

BufferdInputStream?

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From Complete Reference Java2 Chapter 17->
BufferdInputStream has two Constructors

BufferdInputStream(Inputsream inputStream)
BufferdInputStream(Inputsream inputStream,int bufsize)

First form creates a buffered stream using a default buffer size.
In second form, the size of the buffer is passed in bufsize.

Q1>default buffer size means how much?
Q2>If I want to read 1mb file ,then how much bufsize I should required ?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kedar parundekar:

Q1>default buffer size means how much?


It is not specified by the API, but in JDK 1.5.0_06, the buffer is defaulted to 8k:


Originally posted by kedar parundekar:

Q2>If I want to read 1mb file ,then how much bufsize I should required ?



The default buffer is a good compromise between memory use and IO throughput. If you want to experiment with the buffer size, have a look at the IO chapter of the Java Platform Performance book. It explains what the alternatives are and how to benchmark the differences in performance.
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic