Package com.alibaba.fastjson.serializer

Examples of com.alibaba.fastjson.serializer.SerializeWriter.writeInt()


public class SerializeWriterTest extends TestCase {

  public void test_0() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.append('A');
    writer.writeInt(156);
    Assert.assertEquals("A156", writer.toString());
    writer.writeLong(345);
    Assert.assertEquals("A156345", writer.toString());

  }
View Full Code Here


  }

  public void test_1() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeInt(-1);
    Assert.assertEquals("-1", writer.toString());
  }

  public void test_2() throws Exception {
    SerializeWriter writer = new SerializeWriter();
View Full Code Here

        Assert.assertEquals(3, out.size());
        out.reset();
        Assert.assertEquals("", out.toString());
        Assert.assertEquals(0, out.toCharArray().length);
        Assert.assertEquals(0, out.size());
        out.writeInt(Integer.MIN_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MIN_VALUE), out.toString());
        out.flush();
        out.close();
    }
View Full Code Here

        out.close();
    }

    public void test_13() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeInt(Integer.MIN_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MIN_VALUE), out.toString());
    }

    public void test_13_long() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
View Full Code Here

        Assert.assertEquals(Long.toString(Long.MIN_VALUE), out.toString());
    }

    public void test_14() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeInt(Integer.MAX_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MAX_VALUE), out.toString());
    }

    public void test_14_long() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
View Full Code Here

       
        SerializeWriter writer = new SerializeWriter(out, 10);
        Assert.assertEquals(10, writer.getBufferLength());
       
        writer.write("abcde");
        writer.writeInt(12345678);
        writer.close();
       
        String text = out.toString();
        Assert.assertEquals("abcde12345678", text);
    }
View Full Code Here

        Assert.assertEquals(3, out.size());
        out.reset();
        Assert.assertEquals("", out.toString());
        Assert.assertEquals(0, out.toCharArray().length);
        Assert.assertEquals(0, out.size());
        out.writeInt(Integer.MIN_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MIN_VALUE), out.toString());
        out.flush();
        out.close();
    }
View Full Code Here

        out.close();
    }

    public void test_13() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeInt(Integer.MIN_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MIN_VALUE), out.toString());
    }

    public void test_13_long() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
View Full Code Here

        Assert.assertEquals(Long.toString(Long.MIN_VALUE), out.toString());
    }

    public void test_14() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeInt(Integer.MAX_VALUE);
        Assert.assertEquals(Integer.toString(Integer.MAX_VALUE), out.toString());
    }

    public void test_14_long() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
View Full Code Here

public class SerializeWriterTest extends TestCase {

  public void test_0() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.append('A');
    writer.writeInt(156);
    Assert.assertEquals("A156", writer.toString());
    writer.writeLong(345);
    Assert.assertEquals("A156345", 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.