Top Description Fields Constructors Methods
org.eclipse.jgit.transport.http.apache

public Class TemporaryBufferEntity

extends AbstractHttpEntity
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.io.IOException, .InputStream, .OutputStream, org.apache.http.entity.AbstractHttpEntity, org.eclipse.jgit.util.TemporaryBuffer

A org.apache.http.HttpEntity which takes its content from a org.eclipse.jgit.util.TemporaryBuffer
Since
3.3

Field Summary

Modifier and TypeField and Description
private TemporaryBuffer
private Integer
Inherited from org.apache.http.entity.AbstractHttpEntity:
chunkedcontentEncodingcontentTypeOUTPUT_BUFFER_SIZE

Constructor Summary

AccessConstructor and Description
public
TemporaryBufferEntity(TemporaryBuffer
the buffer
buffer
)

Construct a new org.apache.http.HttpEntity which will contain the content stored in the specified buffer

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public TemporaryBuffer

Returns:

buffer containing the content
getBuffer
()

Get the buffer containing the content

public InputStream
getContent()

Implements org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity.

public long
getContentLength()

Implements org.apache.http.HttpEntity.getContentLength.

Tells the length of the content, if known.

public boolean
isRepeatable()

Implements org.apache.http.HttpEntity.isRepeatable.

Tells if the entity is capable of producing its data more than once.

public boolean
isStreaming()

Implements org.apache.http.HttpEntity.isStreaming.

Tells whether this entity depends on an underlying stream.

public void
setContentLength(int
content length
contentLength
)

Set the contentLength

public void
writeTo(OutputStream
the output stream to write entity content to
outstream
)

Implements org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.

Inherited from org.apache.http.entity.AbstractHttpEntity:
consumeContentgetContentEncodinggetContentTypeisChunkedsetChunkedsetContentEncodingsetContentEncodingsetContentTypesetContentTypetoString

Field Detail

bufferback to summary
private TemporaryBuffer buffer
contentLengthback to summary
private Integer contentLength

Constructor Detail

TemporaryBufferEntityback to summary
public TemporaryBufferEntity(TemporaryBuffer buffer)

Construct a new org.apache.http.HttpEntity which will contain the content stored in the specified buffer

Parameters
buffer:TemporaryBuffer

the buffer

Method Detail

closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement. Close destroys the associated buffer used to buffer the entity

Annotations
@Override
Since
4.5
getBufferback to summary
public TemporaryBuffer getBuffer()

Get the buffer containing the content

Returns:TemporaryBuffer

buffer containing the content

getContentback to summary
public InputStream getContent() throws IOException, IllegalStateException

Implements org.apache.http.HttpEntity.getContent.

Doc from org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity. Repeatable entities are expected to create a new instance of InputStream for each invocation of this method and therefore can be consumed multiple times. Entities that are not repeatable are expected to return the same InputStream instance and therefore may not be consumed more than once.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated after the InputStream#close() method is invoked.

Returns:InputStream

content stream of the entity.

Annotations
@Override
Exceptions
IOException:
if the stream could not be created
getContentLengthback to summary
public long getContentLength()

Implements org.apache.http.HttpEntity.getContentLength.

Doc from org.apache.http.HttpEntity.getContentLength.

Tells the length of the content, if known.

Returns:long

the number of bytes of the content, or a negative number if unknown. If the content length is known but exceeds Long.MAX_VALUE, a negative number is returned.

Annotations
@Override
isRepeatableback to summary
public boolean isRepeatable()

Implements org.apache.http.HttpEntity.isRepeatable.

Doc from org.apache.http.HttpEntity.isRepeatable.

Tells if the entity is capable of producing its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not.

Returns:boolean

true if the entity is repeatable, false otherwise.

Annotations
@Override
isStreamingback to summary
public boolean isStreaming()

Implements org.apache.http.HttpEntity.isStreaming.

Doc from org.apache.http.HttpEntity.isStreaming.

Tells whether this entity depends on an underlying stream. Streamed entities that read data directly from the socket should return true. Self-contained entities should return false. Wrapping entities should delegate this call to the wrapped entity.

Returns:boolean

true if the entity content is streamed, false otherwise

Annotations
@Override
setContentLengthback to summary
public void setContentLength(int contentLength)

Set the contentLength

Parameters
contentLength:int

content length

writeToback to summary
public void writeTo(OutputStream outstream) throws IOException

Implements org.apache.http.HttpEntity.writeTo.

Doc from org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.

Parameters
outstream:OutputStream

the output stream to write entity content to

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs