Results 1 to 1 of 1
  1. #1
    trishtren is offline Member
    Join Date
    Feb 2011
    Posts
    53
    Rep Power
    0

    Default Adding print streams

    Hello, im working on a program, however i have a need to have 2 print streams and i wish to add the contents of one to another
    Java Code:
    	private static PrintStream newwriter;
    	private static PrintStream writer2;
    
    newwriter =   new PrintStream("test.txt");
    writer2 =   new PrintStream(); // dont want a new file output, just need the stream
    //what i want to do
    writer2.append("test sentence");
    newwriter.print(writer2);
    The problem is i cant declare writer 2 without giving it a file url the same as newwriter, so basically i end up with 2 files when i only really want one, but it is required of me to maintain both streams. Any ideas?
    Last edited by trishtren; 04-21-2012 at 07:56 PM.

Similar Threads

  1. Cmd process streams
    By helloworld922 in forum Advanced Java
    Replies: 0
    Last Post: 10-20-2010, 08:20 AM
  2. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •