public class LimitedWriter extends java.io.Writer
Writer
that delegates to another Writer
until a given
maximum number of characters has been written. It then writes a final
ellipsis and stops delegating.Constructor and Description |
---|
LimitedWriter(java.io.Writer delegate,
int maxChars) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
java.lang.String |
toString() |
void |
write(char[] buffer,
int offset,
int length) |
public LimitedWriter(java.io.Writer delegate, int maxChars)
public void write(char[] buffer, int offset, int length) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object