Class CommandDecoder
- java.lang.Object
-
- org.apache.maven.surefire.api.stream.AbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
- org.apache.maven.surefire.booter.stream.CommandDecoder
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class CommandDecoder extends AbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.maven.surefire.api.stream.AbstractStreamDecoder
AbstractStreamDecoder.BufferedStream, AbstractStreamDecoder.MalformedFrameException, AbstractStreamDecoder.Memento, AbstractStreamDecoder.Segment, AbstractStreamDecoder.StreamReadStatus
-
-
Field Summary
Fields Modifier and Type Field Description private ForkNodeArguments
arguments
private static SegmentType[]
COMMAND_WITH_ONE_STRING
private static SegmentType[]
COMMAND_WITHOUT_DATA
private static int
DEBUG_SINK_BUFFER_SIZE
private java.io.OutputStream
debugSink
private static int
NO_POSITION
-
Fields inherited from class org.apache.maven.surefire.api.stream.AbstractStreamDecoder
BUFFER_SIZE
-
-
Constructor Summary
Constructors Constructor Description CommandDecoder(java.nio.channels.ReadableByteChannel channel, ForkNodeArguments arguments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
debugStream(byte[] array, int position, int remaining)
Command
decode(AbstractStreamDecoder.Memento memento)
protected byte[]
getEncodedMagicNumber()
private java.io.OutputStream
newDebugSink()
protected SegmentType[]
nextSegmentType(MasterProcessCommand commandType)
protected Command
toMessage(MasterProcessCommand commandType, AbstractStreamDecoder.Memento memento)
-
Methods inherited from class org.apache.maven.surefire.api.stream.AbstractStreamDecoder
checkArguments, checkDelimiter, checkHeader, getArguments, printRemainingStream, read, readByte, readCharset, readInt, readInteger, readLong, readLongPrivate, readMessageType, readSegment, readString
-
-
-
-
Field Detail
-
DEBUG_SINK_BUFFER_SIZE
private static final int DEBUG_SINK_BUFFER_SIZE
- See Also:
- Constant Field Values
-
NO_POSITION
private static final int NO_POSITION
- See Also:
- Constant Field Values
-
COMMAND_WITHOUT_DATA
private static final SegmentType[] COMMAND_WITHOUT_DATA
-
COMMAND_WITH_ONE_STRING
private static final SegmentType[] COMMAND_WITH_ONE_STRING
-
arguments
private final ForkNodeArguments arguments
-
debugSink
private final java.io.OutputStream debugSink
-
-
Constructor Detail
-
CommandDecoder
public CommandDecoder(@Nonnull java.nio.channels.ReadableByteChannel channel, @Nonnull ForkNodeArguments arguments)
-
-
Method Detail
-
decode
public Command decode(@Nonnull AbstractStreamDecoder.Memento memento) throws java.io.IOException, MalformedChannelException
- Specified by:
decode
in classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
- Throws:
java.io.IOException
MalformedChannelException
-
getEncodedMagicNumber
@Nonnull protected final byte[] getEncodedMagicNumber()
- Specified by:
getEncodedMagicNumber
in classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
nextSegmentType
@Nonnull protected SegmentType[] nextSegmentType(@Nonnull MasterProcessCommand commandType)
- Specified by:
nextSegmentType
in classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
toMessage
@Nonnull protected Command toMessage(@Nonnull MasterProcessCommand commandType, @Nonnull AbstractStreamDecoder.Memento memento) throws AbstractStreamDecoder.MalformedFrameException
- Specified by:
toMessage
in classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
- Throws:
AbstractStreamDecoder.MalformedFrameException
-
debugStream
protected void debugStream(byte[] array, int position, int remaining)
- Overrides:
debugStream
in classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
newDebugSink
private java.io.OutputStream newDebugSink()
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
-