Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic