Top Description Fields Constructors Methods
org.mortbay.util

public Class ByteArrayISO8859Writer

extends Writer
Class Inheritance
Imports
java.io.IOException, .OutputStream, .OutputStreamWriter, .Writer

Byte Array ISO 8859 writer. This class combines the features of a OutputStreamWriter for ISO8859 encoding with that of a ByteArrayOutputStream. It avoids many inefficiencies associated with these standard library classes. It has been optimized for standard ASCII characters.
Author
Greg Wilkins (gregw)

Field Summary

Modifier and TypeField and Description
private ByteArrayOutputStream2
private byte[]
private boolean
private int
private OutputStreamWriter
Inherited from java.io.Writer:
lock

Constructor Summary

AccessConstructor and Description
public
ByteArrayISO8859Writer()

Constructor.

public
ByteArrayISO8859Writer(int
Buffer capacity
capacity
)

Constructor.

public

Method Summary

Modifier and TypeMethod and Description
public int
public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.
public void
public void
public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.
public byte[]
public byte[]
public Object
public void
public void
setLength(int l)

public int
size()

public int
public void
write(char c)

public void
write(char[]
Array of characters to be written
ca
)

Overrides java.io.Writer.write.

Writes an array of characters.
public void
write(char[]
Array of characters
ca
,
int
Offset from which to start writing characters
offset
,
int
Number of characters to write
length
)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.
public void
write(String
String to be written
s
)

Overrides java.io.Writer.write.

Writes a string.
public void
write(String
A String
s
,
int
Offset from which to start writing characters
offset
,
int
Number of characters to write
length
)

Overrides java.io.Writer.write.

Writes a portion of a string.
private void
writeEncoded(char[] ca, int offset, int length)

public void
Inherited from java.io.Writer:
appendappendappendnullWriterwrite

Field Detail

_boutback to summary
private ByteArrayOutputStream2 _bout
_bufback to summary
private byte[] _buf
_fixedback to summary
private boolean _fixed
_sizeback to summary
private int _size
_writerback to summary
private OutputStreamWriter _writer

Constructor Detail

ByteArrayISO8859Writerback to summary
public ByteArrayISO8859Writer()

Constructor.

ByteArrayISO8859Writerback to summary
public ByteArrayISO8859Writer(int capacity)

Constructor.

Parameters
capacity:int

Buffer capacity

ByteArrayISO8859Writerback to summary
public ByteArrayISO8859Writer(byte[] buf)

Method Detail

capacityback to summary
public int capacity()
closeback to summary
public void close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

destroyback to summary
public void destroy()
ensureSpareCapacityback to summary
public void ensureSpareCapacity(int n) throws IOException
flushback to summary
public void flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Writer.flush.

Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

getBufback to summary
public byte[] getBuf()
getByteArrayback to summary
public byte[] getByteArray()
getLockback to summary
public Object getLock()
resetWriterback to summary
public void resetWriter()
setLengthback to summary
public void setLength(int l)
sizeback to summary
public int size()
spareCapacityback to summary
public int spareCapacity()
writeback to summary
public void write(char c) throws IOException
writeback to summary
public void write(char[] ca) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes an array of characters.

Parameters
ca:char[]

Array of characters to be written

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(char[] ca, int offset, int length) throws IOException

Implements abstract java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of an array of characters.

Parameters
ca:char[]

Array of characters

offset:int

Offset from which to start writing characters

length:int

Number of characters to write

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(String s) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a string.

Parameters
s:String

String to be written

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(String s, int offset, int length) throws IOException

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of a string.

Parameters
s:String

A String

offset:int

Offset from which to start writing characters

length:int

Number of characters to write

Exceptions
IOException:
If an I/O error occurs
writeEncodedback to summary
private void writeEncoded(char[] ca, int offset, int length) throws IOException
writeToback to summary
public void writeTo(OutputStream out) throws IOException