Examples of UnsafeStringWriter


Examples of com.alibaba.dubbo.common.io.UnsafeStringWriter

     *
     * @param e
     * @return string
     */
    public static String toString(Throwable e) {
      UnsafeStringWriter w = new UnsafeStringWriter();
        PrintWriter p = new PrintWriter(w);
        p.print(e.getClass().getName());
        if (e.getMessage() != null) {
            p.print(": " + e.getMessage());
        }
        p.println();
        try {
            e.printStackTrace(p);
            return w.toString();
        } finally {
            p.close();
        }
    }
View Full Code Here

Examples of com.alibaba.dubbo.common.io.UnsafeStringWriter

     * @param msg
     * @param e
     * @return string
     */
    public static String toString(String msg, Throwable e) {
      UnsafeStringWriter w = new UnsafeStringWriter();
        w.write(msg + "\n");
        PrintWriter p = new PrintWriter(w);
        try {
            e.printStackTrace(p);
            return w.toString();
        } finally {
            p.close();
        }
    }
View Full Code Here

Examples of com.alibaba.dubbo.common.io.UnsafeStringWriter

     *
     * @param e
     * @return string
     */
    public static String toString(Throwable e) {
      UnsafeStringWriter w = new UnsafeStringWriter();
        PrintWriter p = new PrintWriter(w);
        p.print(e.getClass().getName());
        if (e.getMessage() != null) {
            p.print(": " + e.getMessage());
        }
        p.println();
        try {
            e.printStackTrace(p);
            return w.toString();
        } finally {
            p.close();
        }
    }
View Full Code Here

Examples of com.alibaba.dubbo.common.io.UnsafeStringWriter

     * @param msg
     * @param e
     * @return string
     */
    public static String toString(String msg, Throwable e) {
      UnsafeStringWriter w = new UnsafeStringWriter();
        w.write(msg + "\n");
        PrintWriter p = new PrintWriter(w);
        try {
            e.printStackTrace(p);
            return w.toString();
        } finally {
            p.close();
        }
    }
View Full Code Here

Examples of httl.util.UnsafeStringWriter

      } catch (IOException e) {
        throw new RuntimeException(e.getMessage(), e);
      }
      return output.toByteArray();
    } else {
      UnsafeStringWriter writer = new UnsafeStringWriter();
      try {
        render(parameters, writer);
      } catch (IOException e) {
        throw new RuntimeException(e.getMessage(), e);
      }
      return writer.toString();
    }
  }
View Full Code Here

Examples of httl.util.UnsafeStringWriter

* @author Liang Fei (liangfei0201 AT gmail DOT com)
*/
public class StringBuilderOutConverter implements Converter<StringBuilder, Writer> {

  public Writer convert(StringBuilder value, Map<String, Class<?>> types) throws IOException, ParseException {
    return new UnsafeStringWriter(value);
  }
View Full Code Here

Examples of httl.util.UnsafeStringWriter

  public void render() throws IOException, ParseException {
    render(null, Context.getContext().getOut());
  }

  public Object evaluate(Object context) throws ParseException {
    UnsafeStringWriter writer = new UnsafeStringWriter();
    try {
      render(context, writer);
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
    return writer.toString();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.