Apache Tomcat 7.0.37

org.apache.tomcat.util.buf
Class C2BConverter

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

public final class C2BConverter
extends Object

Efficient conversion of character to bytes. This uses the standard JDK mechanism - a writer - but provides mechanisms to recycle all the objects that are used. Input is buffered to improve performance.


Constructor Summary
C2BConverter(ByteChunk output, String encoding)
          Create a converter, with bytes going to a byte buffer.
C2BConverter(String encoding)
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
 
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)
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
 void convert(String s)
          Generate the bytes using the specified encoding.
 void convert(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()
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
 String getEncoding()
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
 void recycle()
          Reset the internal state, empty the buffers.
 void setByteChunk(ByteChunk bb)
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
 
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,
                    String encoding)
             throws IOException
Create a converter, with bytes going to a byte buffer.

Throws:
IOException

C2BConverter

@Deprecated
public C2BConverter(String encoding)
             throws IOException
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.

Create a converter

Throws:
IOException
Method Detail

getByteChunk

@Deprecated
public ByteChunk getByteChunk()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.


getEncoding

@Deprecated
public String getEncoding()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.


setByteChunk

@Deprecated
public void setByteChunk(ByteChunk bb)
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.


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 IOException
Generate the bytes using the specified encoding.

Throws:
IOException

convert

public final void convert(String s,
                          int off,
                          int len)
                   throws IOException
Generate the bytes using the specified encoding.

Throws:
IOException

convert

public final void convert(String s)
                   throws IOException
Generate the bytes using the specified encoding.

Throws:
IOException

convert

public final void convert(char c)
                   throws IOException
Generate the bytes using the specified encoding.

Throws:
IOException

convert

@Deprecated
public final void convert(MessageBytes mb)
                   throws IOException
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.

Convert a message bytes chars to bytes

Throws:
IOException

flushBuffer

public final void flushBuffer()
                       throws IOException
Flush any internal buffers into the ByteOutput or the internal byte[].

Throws:
IOException

Apache Tomcat 7.0.37

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