SizeLimitedOutputStream
public
class
SizeLimitedOutputStream
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.SizeLimitedOutputStream |
A thread safe file backed ERROR(/OutputStream)
that limits the maximum amount of data that can be
written.
Summary
Public constructors | |
---|---|
SizeLimitedOutputStream(long maxDataSize, int numFiles, String tempFilePrefix, String tempFileSuffix)
Creates a |
|
SizeLimitedOutputStream(long maxDataSize, String tempFilePrefix, String tempFileSuffix)
Creates a |
Public methods | |
---|---|
void
|
close()
Closes the write stream |
void
|
delete()
Delete all accumulated data. |
void
|
flush()
|
InputStream
|
getData()
Gets the collected output as a |
void
|
write(byte[] b, int off, int len)
|
void
|
write(int data)
|
Public constructors
SizeLimitedOutputStream
public SizeLimitedOutputStream (long maxDataSize, int numFiles, String tempFilePrefix, String tempFileSuffix)
Creates a SizeLimitedOutputStream
.
Parameters | |
---|---|
maxDataSize |
long : the approximate max size in bytes to keep in the output stream |
numFiles |
int : the max number of backing files to use to store data. Higher values will mean
max data kept will be close to maxDataSize, but with a possible performance
penalty. |
tempFilePrefix |
String : prefix to use for temporary files |
tempFileSuffix |
String : suffix to use for temporary files |
SizeLimitedOutputStream
public SizeLimitedOutputStream (long maxDataSize, String tempFilePrefix, String tempFileSuffix)
Creates a SizeLimitedOutputStream
with default number of backing files.
Parameters | |
---|---|
maxDataSize |
long : the approximate max size to keep in the output stream |
tempFilePrefix |
String : prefix to use for temporary files |
tempFileSuffix |
String : suffix to use for temporary files |
Public methods
close
public void close ()
Closes the write stream
delete
public void delete ()
Delete all accumulated data.
flush
public void flush ()
getData
public InputStream getData ()
Gets the collected output as a ERROR(/InputStream)
.
Returns | |
---|---|
InputStream |
The collected output as a ERROR(/InputStream) . |
write
public void write (byte[] b, int off, int len)
Parameters | |
---|---|
b |
byte |
off |
int |
len |
int |
write
public void write (int data)
Parameters | |
---|---|
data |
int |