Package org.cip4.jdflib.util
Class ByteArrayIOStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
org.cip4.jdflib.util.ByteArrayIOStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
ByteArrayIOFileStream
Shared input / outputStream class write once, read many...
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classbytearrayinputstream that allows duplication without copying -
Field Summary
Fields inherited from class java.io.ByteArrayOutputStream
buf, count -
Constructor Summary
ConstructorsConstructorDescriptioncreates an empty input output stream classByteArrayIOStream(byte[] b) creates a sized input output stream classByteArrayIOStream(int i) creates a sized input output stream classcreate a ByteArrayIOStream from a filecreates an input output stream class from any stream if is alraedy is a buffered inputstream, no copy is made -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()byte[]getBuf()get the internal buffer - be careful, this is THE bufferget a completely buffered and resizable input streamgets an input stream based on the current byte contents and positions - note this operates on the internal datagets an input stream starting at 0 based on the current byte contents - note this operates on the internal datatoString()Methods inherited from class java.io.ByteArrayOutputStream
reset, size, toByteArray, toString, toString, toString, write, write, writeBytes, writeToMethods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
ByteArrayIOStream
public ByteArrayIOStream()creates an empty input output stream class -
ByteArrayIOStream
public ByteArrayIOStream(int i) creates a sized input output stream class- Parameters:
i- the size of the stream
-
ByteArrayIOStream
creates an input output stream class from any stream if is alraedy is a buffered inputstream, no copy is made- Parameters:
is- the inputstream to buffer
-
ByteArrayIOStream
create a ByteArrayIOStream from a file- Parameters:
f- the file- Throws:
IOException
-
ByteArrayIOStream
public ByteArrayIOStream(byte[] b) creates a sized input output stream class- Parameters:
b- the buffer to use (is NOT copied)
-
-
Method Details
-
getBufferedInputStream
get a completely buffered and resizable input stream- Parameters:
is-- Returns:
-
getInputStream
gets an input stream based on the current byte contents and positions - note this operates on the internal data- Returns:
- an input stream
-
getNewStream
gets an input stream starting at 0 based on the current byte contents - note this operates on the internal data- Returns:
- an input stream
-
getBuf
public byte[] getBuf()get the internal buffer - be careful, this is THE buffer- Returns:
- the internal buffer
-
toString
- Overrides:
toStringin classByteArrayOutputStream- See Also:
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classByteArrayOutputStream- See Also:
-