Top Fields Constructors Methods
org.junit.platform.console.command

pack-priv Class StandardStreamsHandler

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.io.IOException, .PrintStream, java.nio.file.Files, .Path, org.jspecify.annotations.Nullable, org.junit.platform.commons.JUnitException

Field Summary

Modifier and TypeField and Description
private @Nullable PrintStream
private @Nullable PrintStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private static boolean
public void
redirectStandardStreams(@Nullable Path
the file path for standard output, or null to indicate no redirection
stdoutPath
,
@Nullable Path
the file path for standard error, or null to indicate no redirection
stderrPath
)

Redirect standard output (stdout) and standard error (stderr) to the specified file paths.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stderrback to summary
private @Nullable PrintStream stderr
stdoutback to summary
private @Nullable PrintStream stdout

Constructor Detail

StandardStreamsHandlerback to summary
pack-priv StandardStreamsHandler()

Method Detail

closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
isSameFileback to summary
private static boolean isSameFile(@Nullable Path path1, @Nullable Path path2)
redirectStandardStreamsback to summary
public void redirectStandardStreams(@Nullable Path stdoutPath, @Nullable Path stderrPath)

Redirect standard output (stdout) and standard error (stderr) to the specified file paths.

If the paths are the same, both streams are redirected to the same file.

The default charset is used for writing to the files.

Parameters
stdoutPath:@Nullable Path

the file path for standard output, or null to indicate no redirection

stderrPath:@Nullable Path

the file path for standard error, or null to indicate no redirection