Methods Summary |
---|
public void | close()
if (throwsException) {
throw new IOException("Exception thrown for testing purposes.");
}
super.close();
|
public void | flush()
if (throwsException) {
throw new IOException("Exception thrown for testing purposes.");
}
super.flush();
|
public void | setThrowsException(boolean newValue)
throwsException = newValue;
|
public int | size()
return position;
|
public byte[] | toByteArray()
byte[] toReturn = new byte[position];
System.arraycopy(buffer, 0, toReturn, 0, position);
return toReturn;
|
public java.lang.String | toString()
return new String(buffer, 0, position);
|
public void | write(byte[] buffer)
if (throwsException) {
throw new IOException("Exception thrown for testing purposes.");
}
for (int i = 0; i < buffer.length; i++) {
write(buffer[i]);
}
|
public void | write(byte[] buffer, int offset, int count)
if (throwsException) {
throw new IOException("Exception thrown for testing purposes.");
}
if (offset < 0 || count < 0 || (offset + count) > buffer.length) {
throw new IndexOutOfBoundsException(); //$NON-NLS-1$
}
for (int i = offset; i < offset + count; i++) {
write(buffer[i]);
}
|
public void | write(int oneByte)
if (throwsException) {
throw new IOException("Exception thrown for testing purposes.");
}
if (position < size) {
buffer[position] = (byte)(oneByte & 255);
position++;
} else {
throw new IOException("Internal buffer overflow.");
}
|