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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:21:59+00:00 2026-06-09T05:21:59+00:00

Hello Stack Overflow community, I am doing multistep processing on some data I am

  • 0

Hello Stack Overflow community,

I am doing multistep processing on some data I am receiving with a java Servlet. The current process I have is that I input the files to a server using Apache File Upload and convert them to a File. Then once input1 is populated with data, I run through a flow similar to this (where the process functions are xsl transforms):

File input1 = new File(FILE_NAME);  // <---this is populated with data
File output1 = new File(TEMP_FILE); // <---this is the temporary file

InputStream read = new FileInputStream(input1); 
OuputStream out = new FileOutputStream(output1);

process1ThatReadsProcessesOutputs( read, out);

out.close();
read.close();

//this is basically a repeat of the above process!
File output2 = new File(RESULT_FILE);  // <--- This is the result file 
InputStream read1 = new FileInputStream(output1);
OutputStream out1 = new FileOutputStream(output2);
Process2ThatReadsProcessesOutputs( read1, out1);
read1.close();
out1.close();
…

So my question is if there is a better way to do this so I do not have to create those temporary Files and recreate streams to those Files? (I am assuming I am incurring a decent performace penatly)

I saw this Most Efficient Way to create InputStream from OutputStream but I am not sure if this is the best route to go…

  • 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-09T05:22:01+00:00Added an answer on June 9, 2026 at 5:22 am

    Just replace FileOutputStream to ByteArrayInputStream vice/versa.

    Example:

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello Stack Overflow community, I'm in the process of learning WP7 development, I'm struggling
Hello good Stack Overflow people, I do have a business problem and would like
Hello there people of stack overflow, I have just started developing with android and
Hello Stack Overflow i hope you are well today, I have this code: $('.add_child').click(function(){
Hello Stack Overflow i hope you are well today; I have a form that
Hello good people of Stack Overflow, I have come with yet another question for
Hello Stack Overflow Experts, i have need of your expertice: I am trying to
Hello stack overflow I need help with this problem. Ok, I have a flat
Consider the following code : HTML: <table> <tr> <td>Hello</td> <td>Stack</td> <td>Overflow</td> </tr> <tr> <td>some</td>
Hello stackoverflow community, I have some code that works on virtually every browser except

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.