- java.lang.Object
-
- java.io.InputStream
-
- org.refcodes.serial.SequenceInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.refcodes.mixin.OffsetAccessor
,SequenceAccessor
public class SequenceInputStream extends InputStream implements org.refcodes.mixin.OffsetAccessor, SequenceAccessor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.OffsetAccessor
org.refcodes.mixin.OffsetAccessor.OffsetBuilder<B extends org.refcodes.mixin.OffsetAccessor.OffsetBuilder<B>>, org.refcodes.mixin.OffsetAccessor.OffsetMutator, org.refcodes.mixin.OffsetAccessor.OffsetProperty
-
Nested classes/interfaces inherited from interface org.refcodes.serial.SequenceAccessor
SequenceAccessor.SequenceBuilder<B extends SequenceAccessor.SequenceBuilder<B>>, SequenceAccessor.SequenceMutator, SequenceAccessor.SequenceProperty
-
-
Constructor Summary
Constructors Constructor Description SequenceInputStream(Sequence aSequence)
Uses the providedSequence
to provideInputStream
functionality.SequenceInputStream(Sequence aSequence, int aOffset)
Uses the providedSequence
to provideInputStream
functionality.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
int
getOffset()
Sequence
getSequence()
Retrieves the value from theSequence
property.int
read()
int
read(byte[] aChunk, int aOffset, int aLength)
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
SequenceInputStream
public SequenceInputStream(Sequence aSequence)
Uses the providedSequence
to provideInputStream
functionality.- Parameters:
aSequence
- TheSequence
to use.
-
SequenceInputStream
public SequenceInputStream(Sequence aSequence, int aOffset)
Uses the providedSequence
to provideInputStream
functionality.
-
-
Method Detail
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] aChunk, int aOffset, int aLength) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
getOffset
public int getOffset()
- Specified by:
getOffset
in interfaceorg.refcodes.mixin.OffsetAccessor
-
getSequence
public Sequence getSequence()
Retrieves the value from theSequence
property. ATTENTION: The originalSequence
including the read bytes is returned, use thegetOffset()
method to access those bytes not yet being read!- Specified by:
getSequence
in interfaceSequenceAccessor
- Returns:
- The
Sequence
stored by theSequence
property.
-
-