Package javax.websocket

Examples of javax.websocket.Encoder$Text


    public ByteBuffer encodeBinary(final Object o) throws EncodeException {
        List<InstanceHandle<? extends Encoder>> decoders = binaryEncoders.get(o.getClass());
        if (decoders != null) {
            for (InstanceHandle<? extends Encoder> decoderHandle : decoders) {
                Encoder decoder = decoderHandle.getInstance();
                if (decoder instanceof Encoder.Binary) {
                    return ((Encoder.Binary) decoder).encode(o);
                } else {
                    try {
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here


    private void print( Object element ) throws IOException, JDOMException
    {
        if( element instanceof Text )
        {
            Text t = (Text)element;
            String s = t.getText();
            if( m_preStack.isPreMode() )
            {
                m_out.print( s );
            }
            else
View Full Code Here

  }
 

  @Test
  public void testTextEmpty() {
    Text content = new Text("");
    assertEquals("", outputString(fraw,     content));
    assertEquals("", outputString(fcompact, content));
    assertEquals("", outputString(fpretty,  content));
    assertEquals("", outputString(ftso,     content));
    assertEquals("", outputString(ftfw,     content));
View Full Code Here

    assertEquals("", outputString(ftfw,     content));
  }
 
  @Test
  public void testTextWhitespace() {
    Text content = new Text(" \r \n \t ");
    assertEquals(expect(" \r \n \t "),
        outputString(fraw,     content));
    assertEquals("",
        outputString(fcompact, content));
    assertEquals("",
View Full Code Here

        outputString(ftfw,     content));
  }

  @Test
  public void testTextWithText() {
    Text content = new Text(" \r & \n \t ");
    assertEquals(expect(" \r &amp; \n \t "),
        outputString(fraw,     content));
    assertEquals(expect("&amp;"),
        outputString(fcompact, content));
    assertEquals(expect("&amp;"),
View Full Code Here

 
  @Test
  public void testMultiWhiteText() {
    Element root = new Element("root");
    root.addContent(new CDATA(" "));
    root.addContent(new Text(" "));
    root.addContent(new Text("    "));
    root.addContent(new Text(""));
    root.addContent(new Text(" "));
    root.addContent(new Text("  \n \n "));
    root.addContent(new Text("  \t "));
    root.addContent(new Text("  "));
    assertEquals(expect("<root><![CDATA[ ]]>        \n \n   \t   </root>"),
        outputString(fraw,     root));
    assertEquals(expect("<root/>"),
        outputString(fcompact, root));
    assertEquals(expect("<root/>"),
View Full Code Here

 
  @Test
  public void testMultiText() {
    Element root = new Element("root");
    root.addContent(new CDATA(" "));
    root.addContent(new Text(" "));
    root.addContent(new Text("    "));
    root.addContent(new Text(""));
    root.addContent(new Text("X"));
    root.addContent(new Text("  \n \n "));
    root.addContent(new Text("  \t "));
    root.addContent(new Text("  "));
    assertEquals(expect("<root><![CDATA[ ]]>     X  \n \n   \t   </root>"),
        outputString(fraw,     root));
    assertEquals(expect("<root>X</root>"),
        outputString(fcompact, root));
    assertEquals(expect("<root>X</root>"),
View Full Code Here

 
 
 
  @Test
  public void testXXX() {
    Text content = new Text("");
    assertEquals("",
        outputString(fraw,     content));
    assertEquals("",
        outputString(fcompact, content));
    assertEquals("",
View Full Code Here

 
 
 
  @Test
  public void testOutputText() {
    checkOutput(new Text(" hello  there  "), " hello  there  ", "hello there", "hello  there", "hello  there", " hello  there  ");
  }
View Full Code Here

  @Test
  public void testOutputElementMultiText() {
    Element root = new Element("root");
    root.addContent(new CDATA(" "));
    root.addContent(new Text(" xx "));
    root.addContent(new Text("yy"));
    root.addContent(new Text("    "));
    root.addContent(new Text("zz"));
    root.addContent(new Text("  ww"));
    root.addContent(new EntityRef("amp"));
    root.addContent(new Text("vv"));
    root.addContent(new Text("  "));
    checkOutput(root,
        "<root><![CDATA[ ]]> xx yy    zz  ww&amp;vv  </root>",
        "<root>xx yy zz ww&amp;vv</root>",
        "<root>xx yy    zz  ww&amp;vv</root>",
        "<root>xx yy    zz  ww&amp;vv</root>",
View Full Code Here

TOP

Related Classes of javax.websocket.Encoder$Text

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.