Top Description Inners Fields Constructors Methods
org.eclipse.jgit.util

public abstract Class TemporaryBuffer

extends OutputStream
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.util.TemporaryBuffer.LocalFile, org.eclipse.jgit.util.TemporaryBuffer.Heap, org.eclipse.jgit.transport.TransportHttp.Service.HttpOutputStream
Imports
java.io.BufferedOutputStream, .File, .FileInputStream, .FileOutputStream, .IOException, .InputStream, .OutputStream, .UncheckedIOException, java.util.ArrayList, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.NullProgressMonitor, .ProgressMonitor

A fully buffered output stream.

Subclasses determine the behavior when the in-memory buffer capacity has been exceeded and additional bytes are still being received for output.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private class
public static class
TemporaryBuffer.Heap

A temporary buffer that will never exceed its in-memory limit.

public static class
TemporaryBuffer.LocalFile

A fully buffered output stream using local disk storage for large data.

Field Summary

Modifier and TypeField and Description
pack-priv ArrayList<TemporaryBuffer.Block>
blocks

Chain of data, if we are still completely in-core; otherwise null.

protected static final int
DEFAULT_IN_CORE_LIMIT

Default limit for in-core storage.

private int
inCoreLimit

Maximum number of bytes we will permit storing in memory.

private int
initialBlocks

Initial size of block list.

private OutputStream
overflow

If inCoreLimit has been reached, remainder goes here.

Constructor Summary

AccessConstructor and Description
protected
TemporaryBuffer(int
maximum number of bytes to store in memory before entering the overflow output path; also used as the estimated size.
limit
)

Create a new empty temporary buffer.

protected
TemporaryBuffer(int
estimated size of storage used, to size the initial list of block pointers.
estimatedSize
,
int
maximum number of bytes to store in memory before entering the overflow output path.
limit
)

Create a new empty temporary buffer.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with this stream.

public void
copy(InputStream
the stream to read from, until EOF is reached.
in
)

Copy all bytes remaining on the input stream into this buffer.

public void
destroy()

Clear this buffer so it has no data, and cannot be used again.

protected void
doFlush()

Dumps the entire buffer into the overflow stream, and flushes it.

private long
private TemporaryBuffer.Block
last()

public long

Returns:

total length of the buffer, in bytes.
length
()

Obtain the length (in bytes) of the buffer.

public InputStream

Returns:

a stream to read from the buffer. The caller must close the stream when it is no longer useful.
openInputStream
()

Open an input stream to read from the buffered data.

public InputStream

Returns:

an InputStream which will automatically destroy any associated temporary file on close()
openInputStreamWithAutoDestroy
()

Same as openInputStream() but handling destruction of any associated resources automatically when closing the returned stream.

protected abstract OutputStream

Returns:

the output stream to receive the buffered content, followed by the remaining output.
overflow
()

Open the overflow output stream, so the remaining output can be stored.

private boolean
public void
reset()

Reset this buffer for reuse, purging all buffered content.

private void
public byte[]

Returns:

the complete byte array; length matches length().
toByteArray
()

Convert this buffer's contents into a contiguous byte array.

public byte[]

Returns:

the byte array limited to limit bytes.
toByteArray
(int
the maximum number of bytes to be returned
limit
)

Convert this buffer's contents into a contiguous byte array.

public String

Returns:

first limit number of bytes of the buffer content converted to String.
toString
(int
the maximum number of bytes to be converted to String
limit
)

Convert first limit number of bytes of the buffer content to String.

public void
write(int
the byte.
b
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.

public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

public void
writeTo(OutputStream
stream to send this buffer's complete content to.
os
,
ProgressMonitor
if not null progress updates are sent here. Caller should initialize the task and the number of work units to length()/1024.
pm
)

Send this buffer to an output stream.

Inherited from java.io.OutputStream:
flushnullOutputStreamwrite

Field Detail

blocksback to summary
pack-priv ArrayList<TemporaryBuffer.Block> blocks

Chain of data, if we are still completely in-core; otherwise null.

DEFAULT_IN_CORE_LIMITback to summary
protected static final int DEFAULT_IN_CORE_LIMIT

Default limit for in-core storage.

inCoreLimitback to summary
private int inCoreLimit

Maximum number of bytes we will permit storing in memory.

When this limit is reached the data will be shifted to a file on disk, preventing the JVM heap from growing out of control.

initialBlocksback to summary
private int initialBlocks

Initial size of block list.

overflowback to summary
private OutputStream overflow

If inCoreLimit has been reached, remainder goes here.

Constructor Detail

TemporaryBufferback to summary
protected TemporaryBuffer(int limit)

Create a new empty temporary buffer.

Parameters
limit:int

maximum number of bytes to store in memory before entering the overflow output path; also used as the estimated size.

TemporaryBufferback to summary
protected TemporaryBuffer(int estimatedSize, int limit)

Create a new empty temporary buffer.

Parameters
estimatedSize:int

estimated size of storage used, to size the initial list of block pointers.

limit:int

maximum number of bytes to store in memory before entering the overflow output path.

Since
4.0

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.OutputStream.close.

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
copyback to summary
public void copy(InputStream in) throws IOException

Copy all bytes remaining on the input stream into this buffer.

Parameters
in:InputStream

the stream to read from, until EOF is reached.

Exceptions
IOException:
an error occurred reading from the input stream, or while writing to a local temporary file.
destroyback to summary
public void destroy()

Clear this buffer so it has no data, and cannot be used again.

doFlushback to summary
protected void doFlush() throws IOException

Dumps the entire buffer into the overflow stream, and flushes it.

Exceptions
IOException:
the overflow stream cannot be started, or the buffer contents cannot be written to it, or it failed to flush.
inCoreLengthback to summary
private long inCoreLength()
lastback to summary
private TemporaryBuffer.Block last()
lengthback to summary
public long length()

Obtain the length (in bytes) of the buffer.

The length is only accurate after close() has been invoked.

Returns:long

total length of the buffer, in bytes.

openInputStreamback to summary
public InputStream openInputStream() throws IOException

Open an input stream to read from the buffered data.

This method may only be invoked after close() has completed normally, to ensure all data is completely transferred.

Returns:InputStream

a stream to read from the buffer. The caller must close the stream when it is no longer useful.

Exceptions
IOException:
an error occurred opening the temporary file.
openInputStreamWithAutoDestroyback to summary
public InputStream openInputStreamWithAutoDestroy() throws IOException

Same as openInputStream() but handling destruction of any associated resources automatically when closing the returned stream.

Returns:InputStream

an InputStream which will automatically destroy any associated temporary file on close()

Exceptions
IOException:
in case of an error.
Since
4.11
overflowback to summary
protected abstract OutputStream overflow() throws IOException

Open the overflow output stream, so the remaining output can be stored.

Returns:OutputStream

the output stream to receive the buffered content, followed by the remaining output.

Exceptions
IOException:
the buffer cannot create the overflow stream.
reachedInCoreLimitback to summary
private boolean reachedInCoreLimit() throws IOException
resetback to summary
public void reset()

Reset this buffer for reuse, purging all buffered content.

switchToOverflowback to summary
private void switchToOverflow() throws IOException
toByteArrayback to summary
public byte[] toByteArray() throws IOException

Convert this buffer's contents into a contiguous byte array.

The buffer is only complete after close() has been invoked.

Returns:byte[]

the complete byte array; length matches length().

Exceptions
IOException:
an error occurred reading from a local temporary file
toByteArrayback to summary
public byte[] toByteArray(int limit) throws IOException

Convert this buffer's contents into a contiguous byte array. If this size of the buffer exceeds the limit only return the first limit bytes

The buffer is only complete after close() has been invoked.

Parameters
limit:int

the maximum number of bytes to be returned

Returns:byte[]

the byte array limited to limit bytes.

Exceptions
IOException:
an error occurred reading from a local temporary file
Since
4.2
toStringback to summary
public String toString(int limit)

Convert first limit number of bytes of the buffer content to String.

Parameters
limit:int

the maximum number of bytes to be converted to String

Returns:String

first limit number of bytes of the buffer content converted to String.

Since
5.12
writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
writeToback to summary
public void writeTo(OutputStream os, ProgressMonitor pm) throws IOException

Send this buffer to an output stream.

This method may only be invoked after close() has completed normally, to ensure all data is completely transferred.

Parameters
os:OutputStream

stream to send this buffer's complete content to.

pm:ProgressMonitor

if not null progress updates are sent here. Caller should initialize the task and the number of work units to length()/1024.

Exceptions
IOException:
an error occurred reading from a temporary file on the local system, or writing to the output stream.
org.eclipse.jgit.util back to summary

pack-priv Class TemporaryBuffer.Block

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final byte[]
pack-priv int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
Block(int sz)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
pack-priv final byte[] buffer
countback to summary
pack-priv int count
SZback to summary
pack-priv static final int SZ

Constructor Detail

Blockback to summary
pack-priv Block()
Blockback to summary
pack-priv Block(int sz)

Method Detail

isFullback to summary
pack-priv boolean isFull()
org.eclipse.jgit.util back to summary

private Class TemporaryBuffer.BlockInputStream

extends InputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private TemporaryBuffer.Block
private int
private int
private byte[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private boolean
public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

public int
read(byte[]
the buffer into which the data is read.
b
,
int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes.

public long
skip(long
the number of bytes to be skipped.
cnt
)

Overrides java.io.InputStream.skip.

Skips over and discards n bytes of data from this input stream.

Inherited from java.io.InputStream:
availableclosemarkmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipNBytestransferTo

Field Detail

blockback to summary
private TemporaryBuffer.Block block
blockIndexback to summary
private int blockIndex
blockPosback to summary
private int blockPos
singleByteBufferback to summary
private byte[] singleByteBuffer

Constructor Detail

BlockInputStreamback to summary
pack-priv BlockInputStream()

Method Detail

nextBlockback to summary
private boolean nextBlock()
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(byte[] b, int off, int len) throws IOException

Overrides java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.

This method blocks until input data is available, end of file is detected, or an exception is thrown.

If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], leaving elements b[off+k] through b[off+len-1] unaffected.

In every case, elements b[0] through b[off-1] and elements b[off+len] through b[b.length-1] are unaffected.

Parameters
b:byte[]

the buffer into which the data is read.

off:int

the start offset in array b at which the data is written.

len:int

the maximum number of bytes to read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.
skipback to summary
public long skip(long cnt) throws IOException

Overrides java.io.InputStream.skip.

Doc from java.io.InputStream.skip.

Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n is negative, the skip method for class InputStream always returns 0, and no bytes are skipped. Subclasses may handle the negative value differently.

Parameters
cnt:long

the number of bytes to be skipped.

Returns:long

the actual number of bytes skipped which might be zero.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
org.eclipse.jgit.util back to summary

public Class TemporaryBuffer.Heap

extends TemporaryBuffer
Class Inheritance

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.

Field Summary

Inherited from org.eclipse.jgit.util.TemporaryBuffer:
blocksDEFAULT_IN_CORE_LIMIT

Constructor Summary

AccessConstructor and Description
public
Heap(int
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.
limit
)

Create a new heap buffer with a maximum storage limit.

public
Heap(int
estimated size of storage used, to size the initial list of block pointers.
estimatedSize
,
int
maximum number of bytes that can be stored in this buffer. Storing beyond this many will cause an IOException to be thrown during write.
limit
)

Create a new heap buffer with a maximum storage limit.

Method Summary

Modifier and TypeMethod and Description
protected OutputStream
overflow()

Implements abstract org.eclipse.jgit.util.TemporaryBuffer.overflow.

Open the overflow output stream, so the remaining output can be stored.

Inherited from org.eclipse.jgit.util.TemporaryBuffer:
closecopydestroydoFlushlengthopenInputStreamopenInputStreamWithAutoDestroyresettoByteArraytoByteArraytoStringwritewritewriteTo

Constructor Detail

Heapback to summary
public Heap(int limit)

Create a new heap buffer with a maximum storage limit.

Parameters
limit:int

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.

Heapback to summary
public Heap(int estimatedSize, int limit)

Create a new heap buffer with a maximum storage limit.

Parameters
estimatedSize:int

estimated size of storage used, to size the initial list of block pointers.

limit:int

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 Detail

overflowback to summary
protected OutputStream overflow() throws IOException

Implements abstract org.eclipse.jgit.util.TemporaryBuffer.overflow.

Doc from org.eclipse.jgit.util.TemporaryBuffer.overflow.

Open the overflow output stream, so the remaining output can be stored.

Returns:OutputStream

the output stream to receive the buffered content, followed by the remaining output.

Annotations
@Override
Exceptions
IOException:
the buffer cannot create the overflow stream.
org.eclipse.jgit.util back to summary

public Class TemporaryBuffer.LocalFile

extends TemporaryBuffer
Class Inheritance

A fully buffered output stream using local disk storage for large data.

Initially this output stream buffers to memory and is therefore similar to ByteArrayOutputStream, but it shifts to using an on disk temporary file if the output gets too large.

The content of this buffered stream may be sent to another OutputStream only after this stream has been properly closed by close().

Field Summary

Modifier and TypeField and Description
private final File
directory

Directory to store the temporary file under.

private File
onDiskFile

Location of our temporary file if we are on disk; otherwise null.

Inherited from org.eclipse.jgit.util.TemporaryBuffer:
blocksDEFAULT_IN_CORE_LIMIT

Constructor Summary

AccessConstructor and Description
public
LocalFile(File
if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.
directory
)

Create a new temporary buffer, limiting memory usage.

public
LocalFile(File
if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.
directory
,
int
maximum number of bytes to store in memory. Storage beyond this limit will use the local file.
inCoreLimit
)

Create a new temporary buffer, limiting memory usage.

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides org.eclipse.jgit.util.TemporaryBuffer.destroy.

Clear this buffer so it has no data, and cannot be used again.

public long
length()

Overrides org.eclipse.jgit.util.TemporaryBuffer.length.

Obtain the length (in bytes) of the buffer.

public InputStream
openInputStream()

Overrides org.eclipse.jgit.util.TemporaryBuffer.openInputStream.

Open an input stream to read from the buffered data.

public InputStream
openInputStreamWithAutoDestroy()

Overrides org.eclipse.jgit.util.TemporaryBuffer.openInputStreamWithAutoDestroy.

Same as openInputStream() but handling destruction of any associated resources automatically when closing the returned stream.

protected OutputStream
overflow()

Implements abstract org.eclipse.jgit.util.TemporaryBuffer.overflow.

Open the overflow output stream, so the remaining output can be stored.

public byte[]
toByteArray()

Overrides org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Convert this buffer's contents into a contiguous byte array.

public byte[]
toByteArray(int
the maximum number of bytes to be returned
limit
)

Overrides org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Convert this buffer's contents into a contiguous byte array.

public void
writeTo(OutputStream
stream to send this buffer's complete content to.
os
,
ProgressMonitor
if not null progress updates are sent here. Caller should initialize the task and the number of work units to length()/1024.
pm
)

Overrides org.eclipse.jgit.util.TemporaryBuffer.writeTo.

Send this buffer to an output stream.

Inherited from org.eclipse.jgit.util.TemporaryBuffer:
closecopydoFlushresettoStringwritewrite

Field Detail

directoryback to summary
private final File directory

Directory to store the temporary file under.

onDiskFileback to summary
private File onDiskFile

Location of our temporary file if we are on disk; otherwise null.

If we exceeded the inCoreLimit we nulled out blocks and created this file instead. All output goes here through overflow.

Constructor Detail

LocalFileback to summary
public LocalFile(File directory)

Create a new temporary buffer, limiting memory usage.

Parameters
directory:File

if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.

LocalFileback to summary
public LocalFile(File directory, int inCoreLimit)

Create a new temporary buffer, limiting memory usage.

Parameters
directory:File

if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.

inCoreLimit:int

maximum number of bytes to store in memory. Storage beyond this limit will use the local file.

Method Detail

destroyback to summary
public void destroy()

Overrides org.eclipse.jgit.util.TemporaryBuffer.destroy.

Doc from org.eclipse.jgit.util.TemporaryBuffer.destroy.

Clear this buffer so it has no data, and cannot be used again.

Annotations
@Override
lengthback to summary
public long length()

Overrides org.eclipse.jgit.util.TemporaryBuffer.length.

Doc from org.eclipse.jgit.util.TemporaryBuffer.length.

Obtain the length (in bytes) of the buffer.

The length is only accurate after close() has been invoked.

Returns:long

total length of the buffer, in bytes.

Annotations
@Override
openInputStreamback to summary
public InputStream openInputStream() throws IOException

Overrides org.eclipse.jgit.util.TemporaryBuffer.openInputStream.

Doc from org.eclipse.jgit.util.TemporaryBuffer.openInputStream.

Open an input stream to read from the buffered data.

This method may only be invoked after close() has completed normally, to ensure all data is completely transferred.

Returns:InputStream

a stream to read from the buffer. The caller must close the stream when it is no longer useful.

Annotations
@Override
Exceptions
IOException:
an error occurred opening the temporary file.
openInputStreamWithAutoDestroyback to summary
public InputStream openInputStreamWithAutoDestroy() throws IOException

Overrides org.eclipse.jgit.util.TemporaryBuffer.openInputStreamWithAutoDestroy.

Doc from org.eclipse.jgit.util.TemporaryBuffer.openInputStreamWithAutoDestroy.

Same as openInputStream() but handling destruction of any associated resources automatically when closing the returned stream.

Returns:InputStream

an InputStream which will automatically destroy any associated temporary file on close()

Annotations
@Override
Exceptions
IOException:
in case of an error.
overflowback to summary
protected OutputStream overflow() throws IOException

Implements abstract org.eclipse.jgit.util.TemporaryBuffer.overflow.

Doc from org.eclipse.jgit.util.TemporaryBuffer.overflow.

Open the overflow output stream, so the remaining output can be stored.

Returns:OutputStream

the output stream to receive the buffered content, followed by the remaining output.

Annotations
@Override
Exceptions
IOException:
the buffer cannot create the overflow stream.
toByteArrayback to summary
public byte[] toByteArray() throws IOException

Overrides org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Doc from org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Convert this buffer's contents into a contiguous byte array.

The buffer is only complete after close() has been invoked.

Returns:byte[]

the complete byte array; length matches length().

Annotations
@Override
Exceptions
IOException:
an error occurred reading from a local temporary file
toByteArrayback to summary
public byte[] toByteArray(int limit) throws IOException

Overrides org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Doc from org.eclipse.jgit.util.TemporaryBuffer.toByteArray.

Convert this buffer's contents into a contiguous byte array. If this size of the buffer exceeds the limit only return the first limit bytes

The buffer is only complete after close() has been invoked.

Parameters
limit:int

the maximum number of bytes to be returned

Returns:byte[]

the byte array limited to limit bytes.

Annotations
@Override
Exceptions
IOException:
an error occurred reading from a local temporary file
writeToback to summary
public void writeTo(OutputStream os, ProgressMonitor pm) throws IOException

Overrides org.eclipse.jgit.util.TemporaryBuffer.writeTo.

Doc from org.eclipse.jgit.util.TemporaryBuffer.writeTo.

Send this buffer to an output stream.

This method may only be invoked after close() has completed normally, to ensure all data is completely transferred.

Parameters
os:OutputStream

stream to send this buffer's complete content to.

pm:ProgressMonitor

if not null progress updates are sent here. Caller should initialize the task and the number of work units to length()/1024.

Annotations
@Override
Exceptions
IOException:
an error occurred reading from a temporary file on the local system, or writing to the output stream.