Methods Summary |
---|
public void | consumeContent()
if (content != null) {
content.close(); // reads to the end of the entity
}
|
public java.io.InputStream | getContent()Obtains the content, once only.
if (this.content == null) {
throw new IllegalStateException("Content has not been provided");
}
if (this.contentObtained) {
throw new IllegalStateException("Content has been consumed");
}
this.contentObtained = true;
return this.content;
|
public long | getContentLength()
return this.length;
|
public boolean | isRepeatable()Tells that this entity is not repeatable.
return false;
|
public boolean | isStreaming()
return !this.contentObtained && this.content != null;
|
public void | setContent(java.io.InputStream instream)Specifies the content.
this.content = instream;
this.contentObtained = false;
|
public void | setContentLength(long len)Specifies the length of the content.
this.length = len;
|
public void | writeTo(java.io.OutputStream outstream)
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
}
InputStream instream = getContent();
int l;
byte[] tmp = new byte[2048];
while ((l = instream.read(tmp)) != -1) {
outstream.write(tmp, 0, l);
}
|