Package org.gocha.text

Examples of org.gocha.text.IndentStackWriter


        Class tmplItf = getInterface();
        if( tmplItf==null )
            throw new IllegalStateException("getTemplateInterface() == null");
       
        StringWriter sw = new StringWriter();
        IndentStackWriter writer = new IndentStackWriter(sw);
        writer.indent("  ");
        writer.level(0);
       
        if( !tmplItf.isInterface() )
            throw new IllegalStateException("getTemplateInterface() is not interface");
       
        defTemplates = new HashMap<String, String>();
        gen(writer);
       
        writer.flush();
       
        GeneratedSource src = new GeneratedSource(sw.toString(), defTemplates);
        return src;
    }
View Full Code Here


           
            Charset cs = FileUtil.UTF8();
           
            FileOutputStream fout = new FileOutputStream(target);
            OutputStreamWriter strW = new OutputStreamWriter(fout, cs);
            IndentStackWriter writer = new IndentStackWriter(strW);
           
            HashMap<String,String> t = new HashMap<String, String>();
            writer.push();
            for(Map.Entry<String,String> kv : props.entrySet()){
                t.put( "key", TextUtil.htmlEncode(kv.getKey()) );
                t.put( "value", TextUtil.htmlEncode(kv.getValue()) );
                writer.println(TextUtil.template(metaTmpl, t));
            }
            String htmlMeta = writer.pop();
           
            t.putAll(props);
            t.put("htmlMeta", htmlMeta);
            t.put("htmlBody", htmlBody);
            t.put("charset", cs.name());
            writer.println(TextUtil.template(htmlTmpl, t));
           
            writer.flush();
            strW.flush();
            fout.flush();
           
            fout.close();
        }catch(Throwable e){
View Full Code Here

        return appd;
    }
   
    private static void print(Throwable ex,int level,IndentStackWriter writer,boolean printExceptionStack){
        if( level<0 )level = 0;
        if( writer==null )writer = new IndentStackWriter(new OutputStreamWriter(System.out));
       
        String message = ex.getMessage();
        String clazz = ex.getClass().getName();
       
        writer.level(level);
View Full Code Here

TOP

Related Classes of org.gocha.text.IndentStackWriter

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.