public static class RandomHandler.RandomEntity extends AbstractHttpEntity
writeTo
but not getContent.| Modifier and Type | Field and Description |
|---|---|
protected int |
delayMs
The duration of the delay before sending the response entity.
|
protected boolean |
drip
Whether to delay after each chunk sent.
|
protected long |
length
The length of the random data to generate.
|
| Constructor and Description |
|---|
RandomEntity(long len)
Creates a new entity generating the given amount of data.
|
RandomEntity(long len,
int delayMs,
boolean drip)
Creates a new entity generating the given amount of data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
InputStream |
getContent()
Not supported.
|
long |
getContentLength()
Obtains the size of the random data.
|
boolean |
isRepeatable()
Tells that this entity is repeatable, in a way.
|
boolean |
isStreaming()
Tells that this entity is not streaming.
|
void |
writeTo(OutputStream out)
Generates the random content.
|
getContentEncoding, getContentType, getTrailerNames, getTrailers, isChunked, toString, writeToprotected final long length
protected final int delayMs
protected final boolean drip
false,
will only delay at the start of the response entity.public RandomEntity(long len)
len - the number of random bytes to generate,
0 to maxintpublic RandomEntity(long len,
int delayMs,
boolean drip)
len - the number of random bytes to generate,
0 to maxintdelayMs - how long to wait before sending the first bytedrip - whether to repeat the delay after each bytepublic final boolean isStreaming()
public boolean isRepeatable()
isRepeatable in interface HttpEntityisRepeatable in class AbstractHttpEntitytruepublic long getContentLength()
public InputStream getContent()
public void writeTo(OutputStream out) throws IOException
writeTo in interface HttpEntitywriteTo in class AbstractHttpEntityout - where to write the content toIOExceptionpublic void close()
throws IOException
IOExceptionCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.