Questions tagged [printstream]

175 questions
0
votes
0 answers

PrintStream print does not have time to create a file

I have a method that create a file: private void createFile(somedata) { try (PrintStream out = new PrintStream( new FileOutputStream(someData))) { out.print(Data); ... } And I need call this method 10 times in…
Vitalii T
  • 453
  • 3
  • 13
0
votes
2 answers

Console output in a matrix format

public class dataarrange { public static void main(String args[]) { try { PrintStream myconsole = new PrintStream(new File("D://out.txt")); for (int i = 0; i < 10; i++) { double a = Math.sqrt(i); …
Encipher
  • 1,370
  • 1
  • 14
  • 31
0
votes
1 answer

python send message to stdout without terminating

I am trying to communicate between a process in my java program and an external python script that is called by the java program. The problem arises that my java program only receives the output of the python program after it has terminated. This…
GregarityNow
  • 707
  • 1
  • 11
  • 25
0
votes
1 answer

Add time to an exception displayed with STDERR

In my application, I use log4j. all the logs are written in a file, but if an error STDERR not handled by my logs occurs, it is redirected in an other file. For example, the non-handled NullPointerException appear in this other file. I need to add…
Skartt
  • 551
  • 2
  • 7
  • 19
0
votes
0 answers

Java 9: Console and PrintStream issue

I'm trying to get the content of the console and append it to a JavaFX TextArea. I've found various examples all around StackOverflow, but all of them use a similar code to this: @FXML public void initialize() throws IOException { Console…
Davide3i
  • 1,035
  • 3
  • 15
  • 35
0
votes
0 answers

Displaying the console lines in JTextArea dynamically, not in 'one go'

I want to get all the stream that I output using System.out.println(...) in the JTextArea and the code below does that absolutely fine however, I have lots of those printlns but the way they are printed in my console is a 'one-off' process. I mean…
0
votes
2 answers

Returning Wrong Indexes of Array

I'm trying to use this to print out only part of an array. My array is 5 elements long - {6, 4, 2, 6, 2} - and I'd like to print just {6, 4, 2, 6, 2}. But using my current code, it's printing out [4, 2, 6, 2] - indexes 1 through 4, not indexes 0…
0
votes
1 answer

Java - Send OutputStream to printer directly from servlet/Controller

Using my spring controller I want to directly open the printing view of generated pdf.By now I am generating a pdf using iTextPDF and put it to the OutputStream (HttpServletResponse.getOutputStream()).It is downloading the pdf. I can open it in…
theCoder379
  • 197
  • 1
  • 3
  • 16
0
votes
1 answer

Why Selenium's DriverService prints to the error stream? and how to avoid it? - Java

I’m using Selenium with ChromeDriverService. In its base class, DriverService, it starts the service and prints output messages to System.err stream. private CommandLine process = null; public void start() throws IOException { lock.lock(); …
user3364652
  • 480
  • 8
  • 23
0
votes
1 answer

method calling architecture/definiton of printf() and format()

Below is code of printf() and format() methods present in java.io.PrintStream public java.io.PrintStream printf(java.lang.String, java.lang.Object...); public java.io.PrintStream printf(java.util.Locale, java.lang.String, java.lang.Object...); …
S Kumar
  • 555
  • 7
  • 21
0
votes
1 answer

Building an HTTP Response Header

Attempting to build a web server from scratch. It's working for html, and other plain text files. Tested in Firefox and Chrome. But I'm having difficulty getting images to display properly. Status 200 returned, in Firefox I get the attached image on…
user1327900
0
votes
1 answer

Print() vs Write() method of System.out

The Javadoc for PrintStream#print(char) states Prints a character. The character is translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int)…
T-Bag
  • 10,916
  • 3
  • 54
  • 118
0
votes
0 answers

Is there a way to use the default System.out stream (i.e. to the DOS window) dynamically?

Can I have dynamic text in the default PrintStream? e.g. say I wanted to give a running report on my program's progess, is it possible to have a percentage display that changes during the opperation, rather then simply having a string that gets new…
Cambot
  • 257
  • 2
  • 13
0
votes
1 answer

Scanning and printing on same file via Java

What I am trying to do with this code: Start by reading the text file "occupancy", which would be initialized with 10 zeros. Assign it to an array(guestsIn[]). Get new data from keyboard input, and update array(guestsIn[]) with new values(Sometimes…
Zeboon
  • 31
  • 1
  • 3
0
votes
2 answers

Closing a printstream

So I am basically creating a bag and I was told that one of my bags must contain at least 100000 elements. This won't fit in the console window of eclipse. So writing the information to a file seems like a better idea. I have put my main method and…