Package org.daisy.dotify.common.io
Class ByteArrayStreamJuggler
- java.lang.Object
-
- org.daisy.dotify.common.io.ByteArrayStreamJuggler
-
- All Implemented Interfaces:
Closeable,AutoCloseable,StreamJuggler
public class ByteArrayStreamJuggler extends Object implements StreamJuggler
Provides an in-memory stream juggler.
-
-
Constructor Summary
Constructors Constructor Description ByteArrayStreamJuggler(File input, File output)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()InputStreamMakergetInputStreamMaker()Get the current input stream maker.OutputStreamgetOutputStream()Get the current output stream.voidreset()Resets the input and output stream so that the input contains the written result and the output is cleared.
-
-
-
Constructor Detail
-
ByteArrayStreamJuggler
public ByteArrayStreamJuggler(File input, File output) throws IOException
Constructs a new instance.- Parameters:
input- An existing input fileoutput- An output file- Throws:
IOException- An IOException is thrown if the input does not exist or if the input or output is a directory.
-
-
Method Detail
-
getInputStreamMaker
public InputStreamMaker getInputStreamMaker()
Description copied from interface:StreamJugglerGet the current input stream maker.- Specified by:
getInputStreamMakerin interfaceStreamJuggler- Returns:
- Returns the current input stream or null if StreamJuggler has been closed
-
getOutputStream
public OutputStream getOutputStream()
Description copied from interface:StreamJugglerGet the current output stream.- Specified by:
getOutputStreamin interfaceStreamJuggler- Returns:
- Returns the current output stream or null if StreamJuggler has been closed
-
reset
public void reset() throws IOExceptionDescription copied from interface:StreamJugglerResets the input and output stream so that the input contains the written result and the output is cleared.- Specified by:
resetin interfaceStreamJuggler- Throws:
IOException- throws IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-