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 ForkNodeArgumentsargumentsprivate static SegmentType[]COMMAND_WITH_ONE_STRINGprivate static SegmentType[]COMMAND_WITHOUT_DATAprivate static intDEBUG_SINK_BUFFER_SIZEprivate java.io.OutputStreamdebugSinkprivate static intNO_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 voidclose()protected voiddebugStream(byte[] array, int position, int remaining)Commanddecode(AbstractStreamDecoder.Memento memento)protected byte[]getEncodedMagicNumber()private java.io.OutputStreamnewDebugSink()protected SegmentType[]nextSegmentType(MasterProcessCommand commandType)protected CommandtoMessage(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:
decodein classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>- Throws:
java.io.IOExceptionMalformedChannelException
-
getEncodedMagicNumber
@Nonnull protected final byte[] getEncodedMagicNumber()
- Specified by:
getEncodedMagicNumberin classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
nextSegmentType
@Nonnull protected SegmentType[] nextSegmentType(@Nonnull MasterProcessCommand commandType)
- Specified by:
nextSegmentTypein classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
toMessage
@Nonnull protected Command toMessage(@Nonnull MasterProcessCommand commandType, @Nonnull AbstractStreamDecoder.Memento memento) throws AbstractStreamDecoder.MalformedFrameException
- Specified by:
toMessagein classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>- Throws:
AbstractStreamDecoder.MalformedFrameException
-
debugStream
protected void debugStream(byte[] array, int position, int remaining)- Overrides:
debugStreamin classAbstractStreamDecoder<Command,MasterProcessCommand,SegmentType>
-
newDebugSink
private java.io.OutputStream newDebugSink()
-
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
-