Questions tagged [printstream]
175 questions
0
votes
1 answer
How to make PrintStream recognize carriage returns (unicode) in a String?
I'm essentially trying to use PrintStream to write a single string to a file that contains line breaks, in this case I think it will be a carriage return (CR) '\u000D'. As to where these line breaks will happen is unknown, so I have to format the…

user3499639
- 35
- 6
0
votes
2 answers
How to output all of the text in my JtextArea to a save file?
Hello there fellow stackers! I'm having a problem creating a proper save function for my game. The main problem I am having is capturing all of the data inside of my J text area named display. The display reflects what moves have been made so far in…
user3080303
0
votes
1 answer
Android- Run a php script from java
I want to run a php script located on a web server from my android app.
this is the code
try {
URL url = new URL("http://www.xxx.com/add.php");
URLConnection con = url.openConnection();
con.setDoOutput(true);
PrintStream out =…

Firas Gerges
- 67
- 1
- 7
0
votes
2 answers
Using PrintWriter to print an array
I have an array named theDirectory, which holds many DirectoryEntrys, each consisting of a name and telno. I now need to print each DirectoryEntry inside theDirectory into a text file.
This is the method I have tried, however i am getting the error:…

Joe Perkins
- 261
- 3
- 9
- 17
0
votes
1 answer
Next line after while loop not executed
I am trying to write contents to a file, but once the while loop prints all the lines , it get's stuck and doesn't go to the next line. The line after while loop are not being executed. My first guess was that maybe the fstream is still waiting for…

Sudhanshu
- 421
- 2
- 6
- 15
0
votes
2 answers
Java application creates empty error.log on program start
I want my application to create an error.log if, and only if, an error occurs. So I did this:
System.setErr(new PrintStream("error.log"));
Works as expected in Eclipse - error happens, error.log with error message pops up in the source dir.. The…

user1854611
- 121
- 8
0
votes
0 answers
How to do input and output files using PrintStream in java?
Trying to have users enter an input file to be read, and then have an output file to "encode" the input file. However, I'm having trouble with the output files, and probably the input files as well, as file processing is where I started to get lost…

rwrulesrw
- 1
- 1
0
votes
1 answer
where is out object created?
There is a static PrintStream reference variable in System class,which calls the print and println methods,but my question is that where does this reference variable is pointing to
? where we have in actual created the object so we are able to call…

user3380123
- 703
- 1
- 6
- 14
0
votes
2 answers
Confused about the PrintStream out variable
The Java documentation page for the System class says that one of its fields is called "out":
static PrintStream out
If I then look at the doc page for the PrintStream class, it says that one of its inherited fields is called "out". If I then click…

user2911290
- 1,396
- 1
- 16
- 26
0
votes
1 answer
My Own Implementation Of PrintStream for Testing
I have a class which does the following
class PersonDumper {
// attributes
public PersonDumper(PrintStream output, Set persons) {
// do stuff
}
public dump() {
for(Person p : persons) {
…

Manuelarte
- 1,658
- 2
- 28
- 47
0
votes
1 answer
write(String) has private access in PrintStream
I have two classes, Test and Test2. Test creates an instance of Test2, which is used to write to a file with PrintStream and FileOutputStream.
I am getting the error:
write(String) has private access in PrintStream
output.write(str);
…

Mdev
- 2,440
- 2
- 17
- 25
0
votes
1 answer
PrintStream error in main "variable output is already defined in main"
I'm currently attempting to make my code produce an output file by using the PrintStream method. MY textbook suggests that I use this particular line of code within my main:
PrintStream output = new PrintStream(new…

user3015607
- 13
- 6
0
votes
1 answer
how to write a TXT file on JavaCC?
I need to write a file TXT using the syntax of Tokens on JavaCC
Eample: (My Code..)
PARSER_BEGIN(ExaF)
import java.io.*;
public class ExaF
{
public static void main( String[] args )throws ParseException
{
try
{
…

ZeroDrako
- 15
- 4
0
votes
1 answer
Why is Java's "out/in" PrintStream field designed to be referenced directly rather than using a getter
This is something I've always been curious about since my first "Hello World"
Why is Java's out PrintStream a static field that is designed to be used rather than making something like a "getOut()" method that would return the PrintStream.…

Matthew Salsamendi
- 294
- 1
- 5
- 14
0
votes
3 answers
PrintStream write() method in Java
Directly from this Java API:
write
public void write(int b)
Writes the specified byte to this stream. If the byte is a newline and
automatic flushing is enabled then the flush method will be invoked.
Note that the byte is written as given; to…

Rollerball
- 12,618
- 23
- 92
- 161