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 class
This class avoids locking which gains the performance of this decoder.static final class
final class
static final class
static enum
Underflow - could not completely read out al bytes in one call. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractStreamDecoder
(ReadableByteChannel channel, ForkNodeArguments arguments, Map<AbstractStreamDecoder.Segment, MT> messageTypes) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkArguments
(AbstractStreamDecoder<M, MT, ST>.Memento memento, int expectedDataElements) protected final void
checkDelimiter
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected final void
checkHeader
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected void
debugStream
(byte[] array, int position, int remaining) abstract M
protected final ForkNodeArguments
protected abstract byte[]
protected abstract ST[]
nextSegmentType
(MT messageType) protected final void
printRemainingStream
(AbstractStreamDecoder<M, MT, ST>.Memento memento) Print the last string which has not been finished by a new line character.protected AbstractStreamDecoder.StreamReadStatus
protected byte
protected Charset
readCharset
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected int
protected Integer
readInteger
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected Long
protected long
readLongPrivate
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected MT
readMessageType
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected AbstractStreamDecoder.Segment
readSegment
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected String
readString
(AbstractStreamDecoder<M, MT, ST>.Memento memento) protected abstract M
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
MalformedChannelException
IOException
-
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
-