Package com.saperion.common.io
Class TempFileByteBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.saperion.common.io.TempFileByteBufferOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class TempFileByteBufferOutputStream extends java.io.OutputStream
AnOutputStream
that stores it's data in aTempFileByteBuffer
.
-
-
Constructor Summary
Constructors Constructor Description TempFileByteBufferOutputStream(int inMemoryBytes)
TempFileByteBufferOutputStream(int inMemoryBytes, java.io.File tempFileDirectory)
TempFileByteBufferOutputStream(TempFileByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TempFileByteBuffer
getBuffer()
Returns anTempFileByteBuffer
that can be used to read the data that is contained in this stream.void
write(byte[] b)
Writes b.length bytes to the end ofTempFileByteBuffer
contained in this stream.void
write(byte[] b, int off, int len)
Writes len bytes to the end ofTempFileByteBuffer
contained in this stream starting from position off.void
write(int b)
Writes this byte to the end of theTempFileByteBuffer
contained in this stream.
-
-
-
Constructor Detail
-
TempFileByteBufferOutputStream
public TempFileByteBufferOutputStream(int inMemoryBytes)
- Parameters:
inMemoryBytes
- number of bytes to keep in memory before using a temp file
-
TempFileByteBufferOutputStream
public TempFileByteBufferOutputStream(int inMemoryBytes, java.io.File tempFileDirectory)
- Parameters:
inMemoryBytes
- number of bytes to keep in memory before using a temp filetempFileDirectory
- directory to store temporary files in
-
TempFileByteBufferOutputStream
public TempFileByteBufferOutputStream(TempFileByteBuffer buffer)
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
Writes this byte to the end of theTempFileByteBuffer
contained in this stream.- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
- See Also:
OutputStream.write(int)
-
write
public void write(byte[] b) throws java.io.IOException
Writes b.length bytes to the end ofTempFileByteBuffer
contained in this stream.- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
- See Also:
OutputStream.write(byte[])
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
Writes len bytes to the end ofTempFileByteBuffer
contained in this stream starting from position off.- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
- See Also:
OutputStream.write(byte[], int, int)
-
getBuffer
public TempFileByteBuffer getBuffer()
Returns anTempFileByteBuffer
that can be used to read the data that is contained in this stream.- Returns:
TempFileByteBuffer
-
-