Package snap.viewx
Class ScanPane.BytesInputStream
java.lang.Object
java.io.InputStream
snap.viewx.ScanPane.BytesInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
- ScanPane
An InputStream that lets you add bytes on the fly.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(byte[] theBytes) Adds bytes to stream.void
Adds string to stream.int
Returns the number of remaining bytes that can be read (or skipped over) from this input stream.void
close()
Closing a BytesArrayInputStream has no effect.void
mark
(int readAheadLimit) Set the current marked position in the stream.boolean
Tests if thisInputStream
supports mark/reset.int
read()
Reads the next byte of data from this input stream.int
read
(byte[] theBytes, int off, int len) Reads up tolen
bytes of data into an array of bytes from this input stream.void
reset()
Resets the buffer to the marked position.long
skip
(long n) Skipsn
bytes of input from this input stream.Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BytesInputStream
public BytesInputStream(byte[] buf)
-
-
Method Details
-
add
Adds string to stream. -
add
public void add(byte[] theBytes) Adds bytes to stream. -
read
public int read()Reads the next byte of data from this input stream.- Specified by:
read
in classInputStream
-
read
public int read(byte[] theBytes, int off, int len) Reads up tolen
bytes of data into an array of bytes from this input stream.- Overrides:
read
in classInputStream
-
skip
public long skip(long n) Skipsn
bytes of input from this input stream.- Overrides:
skip
in classInputStream
-
available
public int available()Returns the number of remaining bytes that can be read (or skipped over) from this input stream.- Overrides:
available
in classInputStream
-
markSupported
public boolean markSupported()Tests if thisInputStream
supports mark/reset.- Overrides:
markSupported
in classInputStream
-
mark
public void mark(int readAheadLimit) Set the current marked position in the stream.- Overrides:
mark
in classInputStream
-
reset
public void reset()Resets the buffer to the marked position.- Overrides:
reset
in classInputStream
-
close
Closing a BytesArrayInputStream has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-