Questions tagged [printstream]
175 questions
0
votes
2 answers
Read from byte array to console (or file) Java
So I have two files, a binary file that I have read into a byte array, and a text file that I have read into an ArrayList of Strings. Now lets assume my ArrayList has the values "char", "int", "double" and serves as the schema for reading my binary…

Taylor C. White
- 836
- 1
- 12
- 30
0
votes
1 answer
JVM_Close returned -1 when closing PrintStream
I'm not particularly proficient with Java.
I'm converting an array of bytes to a String (each byte with a decimal representation) and then writing to a file. Here is a minimal example that reproduces the problem that I'm having (I've left the file…

Froskoy
- 2,967
- 5
- 20
- 21
0
votes
1 answer
Encoding issue with System.out in Java
I'm having difficulties with my logger that I embedded into a JTextArea: when I call the logger.append() method, it just works fine, but when I use System.out.println(), all my French accents are lost.
Here, you have the creation of the logger and…

Maveric78f
- 55
- 6
0
votes
1 answer
How do I switch between String I/O and Object I/O streams in Java?
I'm creating a client-server application wherein the server or client sends strings using PrintStream and reads strings using BufferedReader/InputStreamReader. Eventually, I need to either send an object from the server to the client or vice versa…

NobleUplift
- 5,631
- 8
- 45
- 87
0
votes
1 answer
Java - Strange behaviour on PrintStream with custom OutputStream
I am trying to write a program that redirects System.out to a JTextArea (it doesn't have to be a JTextArea), but when I call System.out.println("Test!") the output to the text area is like so:
\n
st!
\n
The code for my OutputStream:
package…

condorcraft110
- 195
- 1
- 2
- 8
0
votes
1 answer
Why is this basic client-server program not passing data?
I am following the Java Trail on networking. The three KnockKnock classes used as examples (client, server, and protocol) work as intended when I copy/paste them into Eclipse. However, what I really want to do is eliminate the protocol class and…

James Rogers
- 69
- 1
- 7
0
votes
1 answer
Why Java PrintStream have to Overload its print() functions?
Here you are: http://developer.android.com/reference/java/io/PrintStream.html#print%28float%29
Just one function could serve all the purposes:
public void print (Object o) {
if (o == null) {
// print "null"
} else {
// print…

midnite
- 5,157
- 7
- 38
- 52
0
votes
1 answer
capturing error message and to display in console (IDE)
I am running a c++ program (makefile) as a background process using Processbuilder from my java Program. I am capturing the values displayed in my cmd prompt using .getInputStream and displaying in my console (IDE) .
input = new…

sreram
- 99
- 2
- 9
0
votes
5 answers
How to print out the input or JTextFiled
As a part of my program, I just want to print out what the user enters in the jTextField
here is what I do, but does not work at all.
JTextField myInput = new JTextField();
String word = myInput.getText();
myInput.addActionListener(new…

Alex Jj
- 1,343
- 10
- 19
- 30
0
votes
3 answers
Reading From a File of Numbers Using RandomAccessFile Java
I have an assignment to write some numbers in a text file using PrintStream and then reading from that same file using RandomAccessFile. While the writing part works as intended, I get the following output when running my code.
…

Casteurr
- 956
- 3
- 16
- 35
0
votes
1 answer
Doubling System.out
I want to write System.out messages to another OutputStream, but I still want to have the standard output too.
I found an answer on this similar matter Copy and Redirecting System.err Stream:
In short what you need to do is define a PrintStream…

Daniel Szalay
- 4,041
- 12
- 57
- 103
-1
votes
1 answer
Java PrintStream .println() method not outputting to file?
I am trying to write a method which recursively gathers data from files, and writes erroneous data to an error file. See code block:
public static LinkedQueue getStockData(LinkedQueue stockQueue, String startPath) throws Exception {
…

James C
- 11
- 3
-1
votes
1 answer
Edit the method for using System.in and System.out
I have this methods
OutputStream os = new FileOutputStream("out.txt");
InputStream is = new FileInputStream("out.txt");
Transit.outputTransport(Parking, os);
System.out.println(Parking.toString());
Transport forOut =…

Jay Castle
- 49
- 1
- 8
-1
votes
1 answer
Why is third printstream println() command skipped?
I've got a server/client program that I am writing in which a server sends messages to a client and vise versa. It works perfectly, except for the out.println statements in the printRemoteAddress() method. "HELLO1" and "HELLO2" print to the…

Omar N
- 1,720
- 2
- 21
- 33
-1
votes
2 answers
Java static printstream error
Unreported exception java.io.FileNotFoundException; must be
caught or declared to be thrown
I'm writing a basic program to generate a a script. I'm using two methods to write to the file, so, I thought I'd user a static level file and…

Grayson
- 17
- 4