Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:21:48+00:00 2026-05-22T23:21:48+00:00

You can give the BufferedOutputStream constructor a int parameter for the buffer size. I

  • 0

You can give the BufferedOutputStream constructor a int parameter for the buffer size. I my szenario I have one process writing to the disk and on process reading from the disk. Having a default buffer of 8192 bytes causes high fragmentation of big files.

Now I was wondering if I could reduce the fragmentation if I lift the buffer size to 1 Mb.

I think this should work. But does the BufferedOutputStream still respect my buffer if I always call
BufferedOutputStream.write(smallBuffer,0,i); // i being smaller than 8192

i is small because I am catching small paketes (8192 bytes) over the net. But I want BufferedOutputStream to really buffer a lot, and not decide to flush earlier?

Is BufferedOutputStream “stupid” enough to wait until the buffer is full or flush() is called. Or has it got some time based flushing mechanism installed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:21:49+00:00Added an answer on May 22, 2026 at 11:21 pm

    The BufferedOutputStream does not use any time based algorithm or other statistics to invoke flush internally. It will flush as soon as the buffer is full or you flush it explitily (or before the buffered stream is closed).

    In other words: a larger buffer size will reduce fragmentation for your use case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So the issue is the user can either give input that is one int,
In Java you can give the number zero as a single parameter for the
Hopefully someone can give me a pointer. I have an application that makes several
Can someone give me a little help with this? i have three PHP SQL
Any one can give me the gist of the main advantage of using Hibernate?
I hope someone can give me a hand figuring this out. I have been
I was searching for a function that can give me disk information for a
I have created desktop application wherein there are three projects include. any one can
I hope you guys can give me a hand here. I have an Ada
is it possible to give an parameter to the @RaiseEvent annotation? I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.