Package httl.util

Examples of httl.util.UnsafeByteArrayOutputStream.toByteArray()


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


  }

  public byte[] toBytes(String key, Object value) {
    UnsafeByteArrayOutputStream out = new UnsafeByteArrayOutputStream();
    XSTREAM.toXML(value, out);
    return out.toByteArray();
  }

  @SuppressWarnings("unchecked")
  public <T> T valueOf(String str, Class<T> type) throws ParseException {
    if (str == null) {
View Full Code Here

    try {
      render(parameters, output);
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
    return output.toByteArray();
  }

  @Override
  protected void doRenderWriter(Context context, Writer writer) throws Exception {
    throw new UnsupportedOperationException("Unsupported out type " + OutputStream.class.getName()
View Full Code Here

      if ("httl-comment-text.properties".equals(config)
          && ! template.getSource().contains("read(")) {
        expected = expected.replace("<!--", "").replace("-->", "");
      }
      assertEquals(templateName, expected, actualWriter.getBuffer().toString().replace("\r", ""));
      assertEquals(templateName, expected, new String(actualStream.toByteArray()).replace("\r", ""));
      if ("set_parameters.httl".equals(templateName)) {
        assertEquals(templateName, "abc", Context.getContext().get("title"));
      }
    }
  }
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.