public class

EncodeSpecialStreamingContext

extends StreamingContext
implements IFlushable
java.lang.Object
   ↳ com.microstrategy.webapi.StreamingContext
     ↳ com.microstrategy.web.app.transforms.EncodeSpecialStreamingContext

Summary

[Expand]
Inherited Constants
From class com.microstrategy.webapi.StreamingContext
Fields
protected ByteBuffer byteBuffIn
protected ByteBuffer byteBuffOut
protected CharBuffer charBuff
protected CharsetDecoder decoder
protected String encodeCharsetName
protected CharsetEncoder encoder
protected ICharsetModifiable modifier
protected OutputStream out
[Expand]
Inherited Fields
From class com.microstrategy.webapi.StreamingContext
Public Constructors
EncodeSpecialStreamingContext(ContainerServices cs, String encodeName)
Public Methods
void consume(int contentLength, InputStream src)
Request to a consumer to consume specified number of bytes from the input stream
void consume(String decodeCharsetName, int contentLength, InputStream src)
Request to a consumer to consume specified number of bytes from the input stream
void flush()
Protected Methods
void encodeSpecialCharacter(byte b1, byte b2)
Encodes one character as Shift JIS
This is done to special-encode some problematic characters into SJIS because they are not properly encoded by Java.
void transcode(byte[] data, int range)
[Expand]
Inherited Methods
From class com.microstrategy.webapi.StreamingContext
From class java.lang.Object
From interface com.microstrategy.web.app.transforms.IFlushable
From interface com.microstrategy.webapi.IContentConsumer

Fields

protected ByteBuffer byteBuffIn

protected ByteBuffer byteBuffOut

protected CharBuffer charBuff

protected CharsetDecoder decoder

protected String encodeCharsetName

protected CharsetEncoder encoder

protected ICharsetModifiable modifier

protected OutputStream out

Public Constructors

public EncodeSpecialStreamingContext (ContainerServices cs, String encodeName)

Public Methods

public void consume (int contentLength, InputStream src)

Request to a consumer to consume specified number of bytes from the input stream

Parameters
contentLength number of bytes to consume.
src source input stream
Throws
Exception

public void consume (String decodeCharsetName, int contentLength, InputStream src)

Request to a consumer to consume specified number of bytes from the input stream

Parameters
decodeCharsetName decoder charset name
contentLength number of bytes to consume.
src source input stream
Throws
Exception

public void flush ()

Throws
CharacterCodingException
IOException

Protected Methods

protected void encodeSpecialCharacter (byte b1, byte b2)

Encodes one character as Shift JIS
This is done to special-encode some problematic characters into SJIS because they are not properly encoded by Java.
For more information see: http://www-01.ibm.com/support/docview.wss?rs=133&context=SS5RG2&dc=DB560&dc=DB520&uid=swg21064197&loc=en_US&cs=UTF-8&lang=en&rss=ct133rational In addition to the characters mentioned on this link we also special encode circled numbers from 1 to 20 which also break in Japanese
This can be overwritten to encode extra characters
The recommended overwritten code snippet:
protected void encodeShiftJISCharacter(byte b1, byte b2) throws UnsupportedEncodingException {
    if (b1 == 0x15 && b2 == 0x20) {//double dash
        pushSpecialChar((byte) 0x81, (byte) 0x5c)
    } else {
        super.encodeShiftJISCharactor(b1,b2);
    }
}

Throws
IOException
UnsupportedEncodingException

protected void transcode (byte[] data, int range)

Throws
CharacterCodingException
IOException