Questions tagged [printstream]

175 questions
1
vote
2 answers

Redirect minecraft's print stream to a JTextArea

I am making a Minecraft launcher, and i would like to make my own ftb-style console to go with it. any ideas on how i would redirect Minecraft's print stream to a JTextArea?
1
vote
1 answer

Building Java server and I can't get my page to stop loading (using PrintWriter and Buffered Reader)

I'm building a Java server and everything has been working as expected until now. I can serve up a static html page using two methods I wrote: body and header. Now, I am trying to write a new method called "bodywithQueryString". Problem: It…
Kelly
  • 619
  • 8
  • 18
1
vote
3 answers

Issue with file processing

I'm a novice java programmer and I am having trouble with file output with my java project. In this project, I'm supposed to have a "Rock, Paper, Scissors" program which will output the results onto a separate file. When I run the program and then…
Jack L.
  • 405
  • 2
  • 13
  • 31
1
vote
1 answer

For loop isn't printing correct "."

What I am trying to do is have it take a java file that look like this public class test1 { public static void main ( string[] args ) { System.out.println( "This is Test 1." ); } } And it is suppose to output a text file with the proper spacing and…
ItsRainingHP
  • 139
  • 1
  • 4
  • 18
1
vote
1 answer

dynamically naming a text file as output

I have a for loop that in each iteration a text file should be generated. The problem is naming text file. Because of lack of my knowledge in java, I don't know how I should name output files dynamically. The names should be dependent to the index…
MTT
  • 5,113
  • 7
  • 35
  • 61
1
vote
2 answers

Weird Symbols when connecting to windows througth SSH on java (Jsch)

I am trying to execute a command in windows XP with Jsch Shell channel, but for some reason i get weird symbols in my System.out stream and the commands cannot be executed, the code that i use for connect is this: this.session =…
1
vote
1 answer

Writing to a java subprocess

I'm attempting to write to the stdin of a subprocess (both are java apps). Reading the process's output works fine, but inputting does not work using either PrintStream or PrintWriter. Here is a sample program that I wrote to test the odd…
Brian
  • 444
  • 1
  • 4
  • 16
1
vote
3 answers

replacing text in a printstream

Is it possible to have a regexp replace in a printstream? I have a piece of code that logs all text that is shown in my console windows but it also logs ANSI escape codes. I have found this regexp "s:\x1B\[[0-9;]*[mK]::g" to remove them but that…
kukelekuuk00
  • 11
  • 1
  • 5
0
votes
2 answers

Why is PrintStream class reference declared as a static variable in System class in java?

Can I use a PrintStream's println() method without involving the System class?
0
votes
0 answers

PrintStream to ZipOutputStream properly close

To produce two diferent files to a ZipStream I am using two methods receiving an outputStream something like this: private void produceFileA (OutputStream stream){ final PrintStream printer = new PrintStream (stream); ...... } private void…
rdim66
  • 1
  • 1
0
votes
3 answers

Timing issues with PrintStreams

I'm using eclipse IDE, and sometimes, depending on the code, System.err output is printed before than System.out's. For instance: public static void main(String[] args) { System.out.println("Regular text"); //1 …
Mister Smith
  • 27,417
  • 21
  • 110
  • 193
0
votes
0 answers

How would I sort numbers from greatest to least with variables from a file in Java

I am doing homework for my computer programming class in school and I am trying to make a program that reads from a text file and prints out numbers as simple as that. To briefly explain it, it is a program that contains information of people and…
JustZap
  • 17
  • 6
0
votes
1 answer

Storing error message in string after error has occured java?

I need to store an error message in a string after the error has occurred. I am unable to use the try and catch blocks as the error will appear after the initial code is run. Before I was using the code below to store the error message in a file…
0
votes
1 answer

Writing RestAssured logs to StringWriter always seems to cut the last lines of the result

I am running RestAssured tests and I wanted to read info about the request from the logs ( to use in reports). I have a superclass with the following code which the test classes extent. The superclass: import java.io.PrintStream; import…
0
votes
1 answer

Set Output Stream of specific JShell

I have a code : public class App { public static void main(String[] args) { System.out.println("Hello World from main!"); JShell shell = JShell.builder().build(); shell.eval("System.out.println(\"Hello World from…
Jaysmito Mukherjee
  • 1,467
  • 2
  • 10
  • 29