EspressReport 6.6

quadbase.util
Interface IStringCustomizer


public interface IStringCustomizer

This interface is used for displaying non-ASCII characters in EspressChart, e.g. Japaneses Characters. Implement this abstract class first, and pass it into the QbChart.setStringCustomizer() method.

Here is an example of an implementation.


 
 import quadbase.ChartAPI.*;
 import quadbase.util.*;
 
 // This is an example of a user implemented class of IStringCustomizer
 public class StrCustomizer implements IStringCustomizer {
        // default constructor
        public void StrCustomizer() {
        }
 
        // this is the only method that users need to implement
        // method takes in a String argument and returns a "formatted" String
        public String encodeString(String str) {
                try {
                        // Convert this String into bytes according to the specified 
                        //  character encoding, storing the result into a new byte array.
                        byte[] bytes = str.getBytes("8859_1");
 
                        // Construct & return a new String by converting the specified 
                        //  array of bytes using the specified character encoding.
                        return new String(bytes, "SJIS");
                } catch (java.io.UnsupportedEncodingException e) {
                        ex.printStackTrace();
                }
 
                // return null if conversion is un-successful
                return null;
        }
 }
 


Method Summary
 java.lang.String encodeString(java.lang.String str)
          This method takes in a String in the original format(non-ASCII), and returns a String in the new format(ASCII).
 

Method Detail

encodeString

java.lang.String encodeString(java.lang.String str)
This method takes in a String in the original format(non-ASCII), and returns a String in the new format(ASCII).


EspressReport 6.6