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

  • Home
  • SEARCH
  • 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 607621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:22:45+00:00 2026-05-13T17:22:45+00:00

BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream(out.txt) ) ) );

  • 0
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream("out.txt") ) ) );

So let me see if I understand this: A byte output stream is opened for file “out.txt”. It is then fed to a buffered output stream to make file operations faster. The buffered stream is fed to an output stream writer to bridge from bytes to characters. Finally, this writer is fed to a buffered writer… which adds another layer of buffering?

Hmm…

  • 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-13T17:22:46+00:00Added an answer on May 13, 2026 at 5:22 pm

    Yes you are correct.

    I think in this case you could do a lot shorter (see also BufferedWriter)

    BufferedWriter out = new BufferedWriter(new FileWriter("foo.out"));
    

    or if you want nice printing functions:

    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(“foo.out”)));

    It is possibly that the FileWriter creates its own wrapping, but that class will know which way is best.

    In java Streams and Writers are wrappers so you can assemble them to your own needs (by means of stacking them like you do). The classes don’t look at what type of stream/writer they stack on. In your case having several buffers will mean you actually have two buffers, in two different classes. This means they’ll take up some extra memory and possibly some performance loss, but most likely you will never notice this (because it is only a little overhead compared to other performance factors).

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

Sidebar

Related Questions

My ServerSocket writes out the following lines: OutputStreamWriter outstream = new OutputStreamWriter(clientSocket.getOutputStream()); BufferedWriter out
At the moment I have this: try{ // Create file FileWriter fstream = new
I have socket already declared socket like this: serverAddr = InetAddress.getByName(this.ip); socket = new
I have done lots of research on this and tried every method out there
In a Java program (Java 1.5), I have a BufferedWriter that wraps a Filewriter,
I have to write huge data in text[csv] file. I used BufferedWriter to write
I open a txt file on my server, get the Int and want to
I am creating a file in my Android application as follows: HEADINGSTRING = new
I need to download a file using Java. I can use this code to
This is my first question on S.O. I have a very odd problem. Below

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.