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 void
close()
InputStreamMaker
getInputStreamMaker()
Get the current input stream maker.OutputStream
getOutputStream()
Get the current output stream.void
reset()
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:StreamJuggler
Get the current input stream maker.- Specified by:
getInputStreamMaker
in interfaceStreamJuggler
- Returns:
- Returns the current input stream or null if StreamJuggler has been closed
-
getOutputStream
public OutputStream getOutputStream()
Description copied from interface:StreamJuggler
Get the current output stream.- Specified by:
getOutputStream
in interfaceStreamJuggler
- Returns:
- Returns the current output stream or null if StreamJuggler has been closed
-
reset
public void reset() throws IOException
Description copied from interface:StreamJuggler
Resets the input and output stream so that the input contains the written result and the output is cleared.- Specified by:
reset
in interfaceStreamJuggler
- Throws:
IOException
- throws IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-