C2BConverter (Tomcat API Documentation)
Keywords: org.apache.tomcat.util.buf.C2BConverter class

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

## org.apache.tomcat.util.buf
Class C2BConverter

    java.lang.Object
      org.apache.tomcat.util.buf.C2BConverter

    public final class C2BConverter

extends java.lang.Object

Efficient conversion of character to bytes. This uses the standard JDK mechansim - a writer - but provides mechanisms to recycle all the objects that are used. It is compatible with JDK1.1 and up, ( nio is better, but it's not available even in 1.2 or 1.3 )

Constructor Summary
`C2BConverter(ByteChunk output, java.lang.String encoding)` Create a converter, with bytes going to a byte buffer
`C2BConverter(java.lang.String encoding)` Create a converter

Method Summary
`void` | `convert(char c)` Generate the bytes using the specified encoding
`void` | `convert(char[] c, int off, int len)` Generate the bytes using the specified encoding
`void` | `convert(MessageBytes mb)` Convert a message bytes chars to bytes
`void` | `convert(java.lang.String s)` Generate the bytes using the specified encoding
`void` | `convert(java.lang.String s, int off, int len)` Generate the bytes using the specified encoding
`void` | `flushBuffer()` Flush any internal buffers into the ByteOutput or the internal byte[]
`ByteChunk` | `getByteChunk()`
`java.lang.String` | `getEncoding()`
`void` | `recycle()` Reset the internal state, empty the buffers.
`void` | `setByteChunk(ByteChunk bb)`

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

Constructor Detail

### C2BConverter

    public C2BConverter(ByteChunk output,
                        java.lang.String encoding)
                 throws java.io.IOException

  Create a converter, with bytes going to a byte buffer

  Throws:
    `java.io.IOException`

### C2BConverter

    public C2BConverter(java.lang.String encoding)
                 throws java.io.IOException

  Create a converter

  Throws:
    `java.io.IOException`

Method Detail

### getByteChunk

    public ByteChunk getByteChunk()

### getEncoding

    public java.lang.String getEncoding()

### setByteChunk

    public void setByteChunk(ByteChunk bb)

### recycle

    public final void recycle()

  Reset the internal state, empty the buffers. The encoding remain in effect, the internal buffers remain allocated.

### convert

    public final void convert(char[] c,
                              int off,
                              int len)
                       throws java.io.IOException

  Generate the bytes using the specified encoding

  Throws:
    `java.io.IOException`

### convert

    public final void convert(java.lang.String s,
                              int off,
                              int len)
                       throws java.io.IOException

  Generate the bytes using the specified encoding

  Throws:
    `java.io.IOException`

### convert

    public final void convert(java.lang.String s)
                       throws java.io.IOException

  Generate the bytes using the specified encoding

  Throws:
    `java.io.IOException`

### convert

    public final void convert(char c)
                       throws java.io.IOException

  Generate the bytes using the specified encoding

  Throws:
    `java.io.IOException`

### convert

    public final void convert(MessageBytes mb)
                       throws java.io.IOException

  Convert a message bytes chars to bytes

  Throws:
    `java.io.IOException`

### flushBuffer

    public final void flushBuffer()
                           throws java.io.IOException

  Flush any internal buffers into the ByteOutput or the internal byte[]

  Throws:
    `java.io.IOException`

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

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.