|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
org.hd.d.pg2k.svrCore.GenUtils.LengthLimitedOutputStream
public static final class GenUtils.LengthLimitedOutputStream
Prevents more than a specified number of bytes being written to the output stream. Attempting to exceed the limit will result in an IOException being thrown.
Specifically, this will veto the first write that would exceed the limit and all subsequent (non-zero) writes.
Data up until the limit will be written.
Thread-safe.
| Field Summary | |
|---|---|
private int |
bytesWritten
The number of bytes written so far; non-negative. |
private int |
limit
The maximum number of bytes to be written; non-negative. |
| Fields inherited from class java.io.FilterOutputStream |
|---|
out |
| Constructor Summary | |
|---|---|
GenUtils.LengthLimitedOutputStream(java.io.OutputStream out,
int limit)
Creates an output stream with the specified write limit. |
|
| Method Summary | |
|---|---|
int |
getBytesWritten()
Retrieve the number of bytes written so far; non-negative. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class java.io.FilterOutputStream |
|---|
close, flush, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final int limit
private int bytesWritten
Accessed under the instance lock only.
| Constructor Detail |
|---|
public GenUtils.LengthLimitedOutputStream(java.io.OutputStream out,
int limit)
out - the output streamlimit - maximum number of bytes to be allowed; non-negative| Method Detail |
|---|
public int getBytesWritten()
public void write(int b)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOException
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOException
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||