First of all, don't reinitialize the PrintStream object in every loop iteration.

To write to a file, simply call PrintStream's println method. You may not realise it, but when you print to the console, this is exactly what you are doing. System.out is a PrintStream object.

PrintStream out =
    new PrintStream(new File("stuff.txt"));
while (in.hasNext()) {
    String word = in.next();
    out.println(convert(word));
}
Answer from Jade on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › io › PrintStream.html
PrintStream (Java Platform SE 8 )
2 weeks ago - Java™ Platform Standard Ed. 8 ... A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, ...
🌐
Hacker News
news.ycombinator.com › item
A better streams API is possible for JavaScript | Hacker News
1 month ago - They propose just using an async iterator of UInt8Array. I almost like this idea, but it's not quite all the way there · type Stream<T> = { next(): Promise<{ done, value: UInt8Array<T> }> } I propose this, which I call a stream iterator
🌐
YouTube
youtube.com › c › thedinkpickleball
The Dink Pickleball - YouTube
The OG pickleball newsletter: https://newsletter.thedinkpickleball.com-The front page of pickleball: https://www.thedinkpickleball.com/-Compete in The Dink M...
🌐
Strava
developers.strava.com › docs › reference
Strava Developers
(optional) (default to 30) try: ... ActivitiesApi->getKudoersByActivityId: %s\n" % e) [ { "firstname" : "Peter", "lastname" : "S" } ] Returns the laps of an activity identified by an identifier....
🌐
Oracle
docs.oracle.com › en › java › javase › 25 › docs › api › java.base › java › io › class-use › PrintStream.html
Uses of Class java.io.PrintStream (Java SE 25 & JDK 25)
January 20, 2026 - Methods in java.awt with parameters of type PrintStream ... Prints a listing of this component to the specified output stream.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-io-printstream-class-java-set-1
Java.io.Printstream Class in Java | Set 1 - GeeksforGeeks
September 12, 2023 - Syntax :public PrintStream format(String format, Object... args) Parameters: format - A format string as described in Format string syntax args - Arguments referenced by the format specifiers in the format string. The number of arguments is variable and may be zero. Returns: This output stream Throws: IllegalFormatException NullPointerException ... import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Locale; //Java program to demonstrate PrintStream methods class Printstream { public static void main(String args[]) throws FileNotFo
Find elsewhere
🌐
Tutorialspoint
tutorialspoint.com › java › io › printstream_println.htm
Java.io.PrintStream.println() Method
package com.tutorialspoint; import ... args) { // create printstream object PrintStream ps = new PrintStream(System.out); // print this string ps.print("This is a String"); // print new line ps.println(); // print a new string ps.println("New line"); // flush the stream ...
🌐
Coderanch
coderanch.com › t › 611598 › java › System-println
System.out.println() [Solved] (Beginning Java forum at Coderanch)
Prasanna Raman wrote:Thank you, Jeff. I don't understand this line. Is it supposed to be new PrintStream()? No, I copied it directly from System.java. It's some method that returns a reference to a PrintStream object. If you want to look at what it does, you can look at the code yourself.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.io.printstream
PrintStream Class (Java.IO) | Microsoft Learn
A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. [Android.Runtime.Register("java/io/PrintStream", DoNotGenerateAcw=true)] public class PrintStream : ...
🌐
Pub.dev
pub.dev › packages › dio
dio | Dart package
April 21, 2018 - import 'package:dio/dio.dart'; final dio = Dio(); void request() async { Response response; response = await dio.get('/test?id=12&name=dio'); print(response.data.toString()); // The below request is the same as above. response = await dio.get( '/test', queryParameters: {'id': 12, 'name': 'dio'}, ); print(response.data.toString()); } response = await dio.post('/test', data: {'id': 12, 'name': 'dio'}); List<Response> responses = await Future.wait([dio.post('/info'), dio.get('/token')]); response = await dio.download( 'https://pub.dev/', (await getTemporaryDirectory()).path + 'pub.html', ); final rs = await dio.get( url, options: Options(responseType: ResponseType.stream), // Set the response type to `stream`. ); print(rs.data.stream); // Response stream.
Published   Apr 21, 2018
Version   5.9.2
🌐
Baeldung
baeldung.com › home › java › java io › printstream vs printwriter in java
PrintStream vs PrintWriter in Java | Baeldung
January 8, 2024 - In the case of PrintStream, it is a subclass of OutputStream, which is defined in Java as a byte stream. In other words, data is processed byte-by-byte.
🌐
CodeGym
codegym.cc › java blog › java io & nio › java printstream class
Java PrintStream Class
October 11, 2023 - They are print() and println(), ... call System.out.println(). The general purpose of the PrintStream class is to send information to some stream....
🌐
Dart
dart.dev › language
Introduction to Dart
It was modified on $modified.', ); continue; } await file.create(); await file.writeAsString('Start describing $object in this file.'); } on IOException catch (e) { print('Cannot create description for $object: $e'); } } } content_copy · You can also use async*, which gives you a nice, readable way to build streams.
🌐
GeeksforGeeks
geeksforgeeks.org › java › printstream-printlnstring-method-in-java-with-examples
PrintStream println(String) method in Java with Examples - GeeksforGeeks
July 11, 2025 - // Java program to demonstrate ... // Get the String // to be printed in the stream String string = "GFG"; // print the string // to this stream using print() method // This will put the string in the stream // till it is ...
🌐
Openai
developers.openai.com › api › docs › guides › speech-to-text
Speech to text | OpenAI API
1 2 3 4 5 6 7 8 9 10 11 12 13 from openai import OpenAI client = OpenAI() audio_file = open("/path/to/file/speech.mp3", "rb") transcription = client.audio.transcriptions.create( model="gpt-4o-transcribe", file=audio_file, response_format="text", prompt="The following conversation is a lecture about the recent developments around OpenAI, GPT-4.5 and the future of AI." ) print(transcription.text)
🌐
GitHub
github.com › openjdk › jdk › blob › master › src › java.base › share › classes › java › io › PrintStream.java
jdk/src/java.base/share/classes/java/io/PrintStream.java at master · openjdk/jdk
* for this instance of the Java virtual machine. * * @param fileName · * The name of the file to use as the destination of this print · * stream. If the file exists, then it will be truncated to · * zero size; otherwise, a new file will be created.
Author   openjdk
🌐
Jenkins
jenkins.io › doc › book › installing › linux
Linux
Jenkins requires Java to run, yet not all Linux distributions include Java by default.