Package org.cip4.jdflib.util
Class ByteArrayIOFileStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- org.cip4.jdflib.util.ByteArrayIOStream
-
- org.cip4.jdflib.util.ByteArrayIOFileStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class ByteArrayIOFileStream extends ByteArrayIOStream
Shared input / outputStream class write once, read many...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classByteArrayIOFileStream.ByteArrayIOFileInputStreambytearrayinputstream that allows duplication without copying-
Nested classes/interfaces inherited from class org.cip4.jdflib.util.ByteArrayIOStream
ByteArrayIOStream.ByteArrayIOInputStream
-
-
Constructor Summary
Constructors Constructor Description ByteArrayIOFileStream(long maxLength)creates an empty input output stream classByteArrayIOFileStream(java.io.File f, long maxLength, boolean readOnly)create a ByteArrayIOStream from a fileByteArrayIOFileStream(java.io.InputStream is, long maxLength)creates an input output stream class from any stream if is already is a buffered inputstream, no copy is made
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidfinalize()static ByteArrayIOStream.ByteArrayIOInputStreamgetBufferedInputStream(java.io.InputStream is, long maxLen)get a completely buffered and resizable input streamjava.io.FilegetFile()ByteArrayIOStream.ByteArrayIOInputStreamgetInputStream()gets an input stream based on the current byte contents - note this operates on the internal dataintsize()java.lang.StringtoString()voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this byte array output stream.voidwrite(int b)Writes the specified byte to this byte array output stream.-
Methods inherited from class org.cip4.jdflib.util.ByteArrayIOStream
getBuf, getBufferedInputStream, getNewStream
-
-
-
-
Constructor Detail
-
ByteArrayIOFileStream
public ByteArrayIOFileStream(long maxLength)
creates an empty input output stream class- Parameters:
maxLength- the maximum length in memory
-
ByteArrayIOFileStream
public ByteArrayIOFileStream(java.io.InputStream is, long maxLength)creates an input output stream class from any stream if is already is a buffered inputstream, no copy is made- Parameters:
is- the inputstream to buffermaxLength- the maximum length in memory
-
ByteArrayIOFileStream
public ByteArrayIOFileStream(java.io.File f, long maxLength, boolean readOnly)create a ByteArrayIOStream from a file- Parameters:
f- the filemaxLength- the maximum length in memoryreadOnly-- Throws:
java.io.IOException
-
-
Method Detail
-
getBufferedInputStream
public static ByteArrayIOStream.ByteArrayIOInputStream getBufferedInputStream(java.io.InputStream is, long maxLen)
get a completely buffered and resizable input stream- Parameters:
is-- Returns:
-
getInputStream
public ByteArrayIOStream.ByteArrayIOInputStream getInputStream()
gets an input stream based on the current byte contents - note this operates on the internal data- Overrides:
getInputStreamin classByteArrayIOStream- Returns:
- an input stream
-
write
public void write(int b)
Writes the specified byte to this byte array output stream.- Overrides:
writein classjava.io.ByteArrayOutputStream- Parameters:
b- the byte to be written.
-
write
public void write(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this byte array output stream.- Overrides:
writein classjava.io.ByteArrayOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classByteArrayIOStream- See Also:
ByteArrayOutputStream.close()
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
size
public int size()
- Overrides:
sizein classjava.io.ByteArrayOutputStream- Returns:
-
getFile
public java.io.File getFile()
- Returns:
- the file
-
toString
public java.lang.String toString()
- Overrides:
toStringin classByteArrayIOStream- See Also:
Object.toString()
-
-