Top Inners Fields Constructors Methods
org.junit.platform.launcher.core

pack-priv Class StreamInterceptor

extends PrintStream
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .PrintStream, java.nio.charset.Charset, java.util.ArrayDeque, .Deque, .Optional, java.util.concurrent.ConcurrentLinkedDeque, java.util.function.Consumer, org.jspecify.annotations.Nullable

Since
1.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final int
private final Deque<StreamInterceptor.RewindableByteArrayOutputStream>
private final PrintStream
private final ThreadLocal<StreamInterceptor.RewindableByteArrayOutputStream>
private final Consumer<PrintStream>

Constructor Summary

AccessConstructor and Description
private
StreamInterceptor(PrintStream originalStream, Consumer<PrintStream> unregisterAction, int maxNumberOfBytesPerThread)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv String
private @Nullable StreamInterceptor.RewindableByteArrayOutputStream
private void
pack-priv static Optional<StreamInterceptor>
register(PrintStream originalStream, Consumer<PrintStream> streamSetter, int maxNumberOfBytesPerThread)

pack-priv static Optional<StreamInterceptor>
registerStderr(int maxNumberOfBytesPerThread)

pack-priv static Optional<StreamInterceptor>
registerStdout(int maxNumberOfBytesPerThread)

pack-priv void
public void
write(int b)

Overrides java.io.PrintStream.write.

Writes the specified byte to this stream.

public void
write(byte[] b)

Overrides java.io.PrintStream.write.

Writes all bytes from the specified byte array to this stream.

public void
write(byte[] buf, int off, int len)

Overrides java.io.PrintStream.write.

Writes len bytes from the specified byte array starting at offset off to this stream.

Inherited from java.io.PrintStream:
appendappendappendcharsetcheckErrorclearErrorcloseflushformatformatprintprintprintprintprintprintprintprintprintprintfprintfprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnsetErrorwriteBytes

Field Detail

maxNumberOfBytesPerThreadback to summary
private final int maxNumberOfBytesPerThread
mostRecentOutputsback to summary
private final Deque<StreamInterceptor.RewindableByteArrayOutputStream> mostRecentOutputs
originalStreamback to summary
private final PrintStream originalStream
outputback to summary
private final ThreadLocal<StreamInterceptor.RewindableByteArrayOutputStream> output
unregisterActionback to summary
private final Consumer<PrintStream> unregisterAction

Constructor Detail

StreamInterceptorback to summary
private StreamInterceptor(PrintStream originalStream, Consumer<PrintStream> unregisterAction, int maxNumberOfBytesPerThread)

Method Detail

captureback to summary
pack-priv void capture()
consumeback to summary
pack-priv String consume()
getOutputback to summary
private @Nullable StreamInterceptor.RewindableByteArrayOutputStream getOutput()
pushToTopback to summary
private void pushToTop(StreamInterceptor.RewindableByteArrayOutputStream out)
registerback to summary
pack-priv static Optional<StreamInterceptor> register(PrintStream originalStream, Consumer<PrintStream> streamSetter, int maxNumberOfBytesPerThread)
registerStderrback to summary
pack-priv static Optional<StreamInterceptor> registerStderr(int maxNumberOfBytesPerThread)
registerStdoutback to summary
pack-priv static Optional<StreamInterceptor> registerStdout(int maxNumberOfBytesPerThread)
unregisterback to summary
pack-priv void unregister()
writeback to summary
public void write(int b)

Overrides java.io.PrintStream.write.

Doc from java.io.PrintStream.write.

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 on the underlying output stream.

Note that the byte is written as given; to write a character that will be translated according to the default charset, use the print(char) or println(char) methods.

Annotations
@Override
writeback to summary
public void write(byte[] b)

Overrides java.io.PrintStream.write.

Doc from java.io.PrintStream.write.

Writes all bytes from the specified byte array to this stream. If automatic flushing is enabled then the flush method will be invoked on the underlying output stream.

Note that the bytes will be written as given; to write characters that will be translated according to the default charset, use the print(char[]) or println(char[]) methods.

Annotations
@Override
writeback to summary
public void write(byte[] buf, int off, int len)

Overrides java.io.PrintStream.write.

Doc from java.io.PrintStream.write.

Writes len bytes from the specified byte array starting at offset off to this stream. If automatic flushing is enabled then the flush method will be invoked on the underlying output stream.

Note that the bytes will be written as given; to write characters that will be translated according to the default charset, use the print(char) or println(char) methods.

Annotations
@Override
org.junit.platform.launcher.core back to summary

pack-priv Class StreamInterceptor.RewindableByteArrayOutputStream

extends ByteArrayOutputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Deque<Integer>
Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv void
mark()

pack-priv String
Inherited from java.io.ByteArrayOutputStream:
closeresetsizetoByteArraytoStringtoStringtoStringtoStringwritewritewriteByteswriteTo

Field Detail

markedPositionsback to summary
private final Deque<Integer> markedPositions

Constructor Detail

RewindableByteArrayOutputStreamback to summary
pack-priv RewindableByteArrayOutputStream()

Method Detail

isMarkedback to summary
pack-priv boolean isMarked()
markback to summary
pack-priv void mark()
rewindback to summary
pack-priv String rewind()