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 8249359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:30:58+00:00 2026-06-07T23:30:58+00:00

I am reading a file using BufferedReader in java. Here are the sequence of

  • 0

I am reading a file using BufferedReader in java. Here are the sequence of operations that I am trying to do as reading the file

  1. Keep reading up to certain length of characters in the file
  2. Once it reads up to the length, do some manipuation on the read string
  3. Write the read string to a temp file
  4. Reset all the counters (ex. counter of the length)
  5. Go back #1 and do this again for rest of file

What I am trying to figure out is #3. I want to append to temp file as I am writing to file using BufferedWriter. I know there is append() but, that looks like it write to new line. However, I want to write to next cursor each time. Basically, i want to preserve the format of the original file. Make a exact same file except some value being changed.

I hope this make sense.

thanks.

  • 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-06-07T23:31:01+00:00Added an answer on June 7, 2026 at 11:31 pm

    You can use a FileWriter by passing true as the second argument to its constructor. This will cause the FileWriter to append to the end of the file rather than overwrite the existing contents.

    http://docs.oracle.com/javase/6/docs/api/java/io/FileWriter.html

    BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
    //calls to write will now append
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Java BufferedReader and reading file line by line using bufferedReader.readline(). Is
I'm reading a file using bufferedreader, so lets say i have line = br.readLine();
I'm reading a local file using a BufferedReader wrapped around a FileReader: BufferedReader reader
I'm reading a csv file using c# here is a little code snippet. using
I'm reading a large xml file using HttpURLConnection in java as follows. StringBuilder responseBuilder
I'm trying to download a gzipped file (~390Mo) from a FTP file using java.
I'm using BufferedReader to read a .csv file. I have no problem reading the
I'm reading numbers from a txt file using BufferedReader for analysis. The way I'm
I'm trying to read a text file, i'm using fileImputStream, and reading all the
Hello I'm using a configuration file from src/main/resources in my java application. I'm reading

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.