Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fujitsu.iflow.model.util
Class WriterUTF8OutputStream

    java.lang.Object
      java.io.OutputStream
          com.fujitsu.iflow.model.util.WriterUTF8OutputStream

public class WriterUTF8OutputStream
extends java.io.OutputStream

WriterUTF8OutputStream Lets say you have a Writer (such as the out object in a JSP) and you need an OutputStream because something like XML demands it. While you can easily make a Writer on top of an OutputStream, this class is to allow you to go the other way. It is an OutputStream, so it accepts byte oriented writes, which it converts to characters and writes to the wrapped writer. This does the proper conversion for UTF8 encoded byte stream to Unicode characters. Other encodings are not supported.

Constructor Summary
`WriterUTF8OutputStream(java.io.Writer writer)` Composes an InputStream stream from any other Reader you may have around.

Method Summary
`void` | `close()` Closes the Stringreader.
`void` | `flush()` Flush.
`void` | `write(int b)` Receives a byte value, converts properly to a UTF-16 character and writes it to the Writer.

Methods inherited from class java.io.OutputStream
`write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WriterUTF8OutputStream

    public WriterUTF8OutputStream(java.io.Writer writer)

  Composes an InputStream stream from any other Reader you may have around.

Parameters:
  `writer` - The object to write to. Must not be `null`.

Method Detail

### write

    public void write(int b)
               throws java.io.IOException

  Receives a byte value, converts properly to a UTF-16 character and writes it to the Writer. If the value is less than 128 it is written directly. If more than 127 the character is saved and waits for the rest of the multibyte sequence before the resulting character is written.

  Parameters:
    `b` - the value of the next byte of the UTF-8 stream to write.
  Throws:
    `java.io.IOException` - if the wrapped Writer fails to write

### flush

    public void flush()
               throws java.io.IOException

  Flush.

  Throws:
    `java.io.IOException` - if the original Writer fails to be closed

### close

    public void close()
               throws java.io.IOException

  Closes the Stringreader.

  Throws:
    `java.io.IOException` - if the original Writer fails to be closed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD