Package com.volantis.charset.configuration

Examples of com.volantis.charset.configuration.Charset


        Encoding enc = (Encoding) preloadMap.get("utf-8");
        assertNotNull("No encoding in preloadMap", enc);
        if(enc != null) {
            assertEquals("preloadMap not correct", enc.getMIBEnum(), 106);
        }
        Charset cs = (Charset) charsetMap.get("utf-8");
        assertNotNull("No character set in charsetMap", cs);
        if(cs != null) {
            String name = cs.getName();
            assertEquals("Wrong charset in charsetMap", name, "utf-8");
        }
    }
View Full Code Here


            // various maps.
            ArrayList charsets = css.getCharsets();

            Iterator i = charsets.iterator();
            while(i.hasNext()) {
                Charset cs = (Charset) i.next();

                String name = cs.getName();
                this.charsetMap.put(name, cs);
                ArrayList aliases = cs.getAlias();
                if(aliases != null) {
                    Iterator aliasIterator = aliases.iterator();
                    while(aliasIterator.hasNext()) {
                        Alias a = (Alias) aliasIterator.next();
                        charsetNameAliasMap.put(a.getName(), name);
                    }
                }
                // Check to see whether this charset needs preloading.
                if(cs.isPreload()) {
                    try {
                        preloadedEncodingMap.put(name, createEncoding(cs));
                    } catch (UnsupportedEncodingException e) {
                        // This will only happen if we or the user add a
                        // preloaded charset which is not supported by the
View Full Code Here

   
    private Encoding searchCharset(String charsetName)
            throws UnsupportedEncodingException {
        Encoding encoding;
        // If this charset was in the config file...
        Charset charset = (Charset) charsetMap.get(charsetName);
        if (charset != null) {
            // Then we can create a Encoding from the charset.
            if (logger.isDebugEnabled()) {
                logger.debug("A charset configuration was found for '" +
                        charsetName + "', creating encoding from " +
View Full Code Here

       
        ArrayList charset = css.getCharsets();
        assertNotNull("No charset information", charset);
       
        // Construct a UTF8 charset so we can get the index in the ArrayList
        Charset UTF8 = new Charset();
        UTF8.setName("utf-8");
        UTF8.setMIBenum(106);
        UTF8.setPreload(true);
        UTF8.setComplete(true);
       
        int utf8Index = charset.indexOf(UTF8);
       
        Charset cs = (Charset) charset.get(utf8Index);
        assertNotNull("No utf8 charset in map", cs);
       
        assertEquals("UTF-8 charset not correctly configured", cs.getName(), "utf-8");
        assertEquals("MIBenum not correct", cs.getMIBenum(), 106);
        assertTrue("Complete attribute is false", cs.isComplete());
        assertTrue("Preload attribute is false", cs.isPreload());
       
        ArrayList aliases = cs.getAlias();
        assertNotNull("No aliases found", aliases);
       
        Alias UTF8Alias = new Alias();
        UTF8Alias.setName("UTF8");
       
View Full Code Here

TOP

Related Classes of com.volantis.charset.configuration.Charset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.