Package com.saperion.common.io
Class ReadOnceTempFileByteBuffer
- java.lang.Object
-
- com.saperion.common.io.TempFileByteBuffer
-
- com.saperion.common.io.ReadOnceTempFileByteBuffer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ReadOnceTempFileByteBuffer extends TempFileByteBuffer
This sub-class ofTempFileByteBuffer
is only capable to return oneInputStream
. When this call is invoked the responsibility to delete a possible temporary file is given to the input stream which in turn will delete said file when closed.- Author:
- jschwarz
-
-
Field Summary
-
Fields inherited from class com.saperion.common.io.TempFileByteBuffer
MINIMUM_BUFFER_SIZE
-
-
Constructor Summary
Constructors Constructor Description ReadOnceTempFileByteBuffer(int inMemoryBytes)
ReadOnceTempFileByteBuffer(int inMemoryBytes, java.io.File tempFileDirectory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.io.InputStream
getInputStream()
-
Methods inherited from class com.saperion.common.io.TempFileByteBuffer
append, append, append, getDirectory, getMaxInMemoryBytes, getSize, inMemory
-
-
-
-
Constructor Detail
-
ReadOnceTempFileByteBuffer
public ReadOnceTempFileByteBuffer(int inMemoryBytes)
- Parameters:
inMemoryBytes
- number of bytes to keep in memory before using a temp file
-
ReadOnceTempFileByteBuffer
public ReadOnceTempFileByteBuffer(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
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Overrides:
getInputStream
in classTempFileByteBuffer
- Returns:
- an input stream to read the bytes stored in this buffer
- Throws:
java.io.IOException
- IO exception when opering the stream
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classTempFileByteBuffer
- Throws:
java.io.IOException
-
-