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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:43:44+00:00 2026-06-13T21:43:44+00:00

When I use the object OutputSupplier , adding the first line ( CharStreams.write )

  • 0

When I use the object OutputSupplier, adding the first line (CharStreams.write) is executed correctly. But then calling CharStreams.write again throws an IOException.

Is this the correct behavior of the object? If so, how can you append a String to the supplier object without closing the inline stream?

...

final Process process = Runtime.getRuntime().exec("su");

OutputSupplier<OutputStreamWriter> writerSupplier = CharStreams.newWriterSupplier(new OutputSupplier<OutputStream>() {
    @Override
    public OutputStream getOutput() throws IOException {
        return process.getOutputStream();
    }
}, Charsets.UTF_8);
// ok
CharStreams.write(someCommand, writerSupplier);
...
// IOException
CharStreams.write(otherCommand, writerSupplier);
  • 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-13T21:43:45+00:00Added an answer on June 13, 2026 at 9:43 pm

    This is definitely expected behavior.

    CharStreams.write with an OutputSupplier opens the output stream, writes, and closes it. That’s part of the point. Presumably, Process.getOutputStream() doesn’t let you open and close more than once.

    Either do all the writes at once, or more likely, don’t use CharStreams.write and deal with closing the stream yourself.

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

Sidebar

Related Questions

I tried to use object expression to extend the IDelegateEvent, but in fsi there
I use Object#freeze to freeze the value of an object. I can write a
I'm following a php pagination tutorial that uses MYSQL but I use MYSQLI object
I understand why you need to use Object.prototype.toString() or String() for typechecking arrays, but
Perhaps I'm missing something major, but is there a way to use Object.watch() on
I want to use Object Handler for Sprite but any of the Handler not
I use object buffering to buffer the output of my php pages using ob_start('ob_gzhandler');
I'd like to use object database to persist some classes created in IronPython. The
Why I have to use Object[] to print the list if I select specific
How to decide when to use object adapter and when to use class adapter?

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.