java.lang.Object
org.apache.maven.surefire.api.stream.AbstractStreamDecoder<M,MT,ST>
- Type Parameters:
M- message objectMT- enum describing the meaning of the messageST- enum for segment type
- All Implemented Interfaces:
AutoCloseable
public abstract class AbstractStreamDecoder<M,MT extends Enum<MT>,ST extends Enum<ST>>
extends Object
implements AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classThis class avoids locking which gains the performance of this decoder.static final classfinal classstatic final classstatic enumUnderflow - could not completely read out al bytes in one call. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStreamDecoder(ReadableByteChannel channel, ForkNodeArguments arguments, Map<AbstractStreamDecoder.Segment, MT> messageTypes) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckArguments(AbstractStreamDecoder<M, MT, ST>.Memento memento, int expectedDataElements) protected final voidcheckDelimiter(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected final voidcheckHeader(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected voiddebugStream(byte[] array, int position, int remaining) abstract Mprotected final ForkNodeArgumentsprotected abstract byte[]protected abstract ST[]nextSegmentType(MT messageType) protected final voidprintRemainingStream(AbstractStreamDecoder<M, MT, ST>.Memento memento) Print the last string which has not been finished by a new line character.protected AbstractStreamDecoder.StreamReadStatusprotected byteprotected CharsetreadCharset(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected intprotected IntegerreadInteger(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected Longprotected longreadLongPrivate(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected MTreadMessageType(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected AbstractStreamDecoder.SegmentreadSegment(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected StringreadString(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected abstract MMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
-
-
Constructor Details
-
AbstractStreamDecoder
protected AbstractStreamDecoder(@Nonnull ReadableByteChannel channel, @Nonnull ForkNodeArguments arguments, @Nonnull Map<AbstractStreamDecoder.Segment, MT> messageTypes)
-
-
Method Details
-
decode
public abstract M decode(@Nonnull AbstractStreamDecoder<M, MT, throws MalformedChannelException, IOExceptionST>.Memento memento) - Throws:
MalformedChannelExceptionIOException
-
getEncodedMagicNumber
-
nextSegmentType
-
toMessage
-
getArguments
-
debugStream
protected void debugStream(byte[] array, int position, int remaining) -
readMessageType
protected MT readMessageType(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readSegment
@Nonnull protected AbstractStreamDecoder.Segment readSegment(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readCharset
@Nonnull protected Charset readCharset(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readString
protected String readString(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readInteger
protected Integer readInteger(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readByte
protected byte readByte(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readInt
protected int readInt(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readLong
protected Long readLong(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
readLongPrivate
protected long readLongPrivate(@Nonnull AbstractStreamDecoder<M, MT, throws IOException, AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
checkDelimiter
protected final void checkDelimiter(AbstractStreamDecoder<M, MT, throws AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
checkHeader
protected final void checkHeader(AbstractStreamDecoder<M, MT, throws AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento) -
checkArguments
protected void checkArguments(AbstractStreamDecoder<M, MT, throws AbstractStreamDecoder.MalformedFrameExceptionST>.Memento memento, int expectedDataElements) -
printRemainingStream
Print the last string which has not been finished by a new line character.- Parameters:
memento- current memento object
-
read
@Nonnull protected AbstractStreamDecoder.StreamReadStatus read(@Nonnull AbstractStreamDecoder<M, MT, throws IOExceptionST>.Memento memento, int recommendedCount) - Throws:
IOException
-