Package org.eclipse.jgit.util
Class TemporaryBuffer.Heap
java.lang.Object
java.io.OutputStream
org.eclipse.jgit.util.TemporaryBuffer
org.eclipse.jgit.util.TemporaryBuffer.Heap
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Enclosing class:
- TemporaryBuffer
A temporary buffer that will never exceed its in-memory limit.
If the in-memory limit is reached an IOException is thrown, rather than attempting to spool to local disk.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.util.TemporaryBuffer
TemporaryBuffer.Block, TemporaryBuffer.Heap, TemporaryBuffer.LocalFile
-
Field Summary
Fields inherited from class org.eclipse.jgit.util.TemporaryBuffer
blocks, DEFAULT_IN_CORE_LIMIT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OutputStream
overflow()
Open the overflow output stream, so the remaining output can be stored.Methods inherited from class org.eclipse.jgit.util.TemporaryBuffer
close, copy, destroy, doFlush, length, openInputStream, openInputStreamWithAutoDestroy, reset, toByteArray, toByteArray, toString, write, write, writeTo
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
Heap
public Heap(int limit) Create a new heap buffer with a maximum storage limit.- Parameters:
limit
- maximum number of bytes that can be stored in this buffer; also used as the estimated size. Storing beyond this many will cause an IOException to be thrown during write.
-
Heap
public Heap(int estimatedSize, int limit) Create a new heap buffer with a maximum storage limit.- Parameters:
estimatedSize
- estimated size of storage used, to size the initial list of block pointers.limit
- maximum number of bytes that can be stored in this buffer. Storing beyond this many will cause an IOException to be thrown during write.- Since:
- 4.0
-
-
Method Details
-
overflow
Description copied from class:TemporaryBuffer
Open the overflow output stream, so the remaining output can be stored.- Specified by:
overflow
in classTemporaryBuffer
- Returns:
- the output stream to receive the buffered content, followed by the remaining output.
- Throws:
IOException
- the buffer cannot create the overflow stream.
-