size() public méthode

public size ( ) : int
Résultat int
Exemple #1
0
 public void TestEncodeDecode()
 {
     {
         OtpOutputStream os  = new OtpOutputStream(new Erlang.Atom("abc"));
         OtpInputStream  ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         Assert.IsTrue("abc" == ins.read_atom());
     }
     {
         OtpOutputStream os  = new OtpOutputStream(new Erlang.String("string"));
         OtpInputStream  ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         Assert.IsTrue("string" == ins.read_string());
     }
     {
         Erlang.Pid      pid = new Erlang.Pid("abc", 1, 2, 3);
         OtpOutputStream os  = new OtpOutputStream(pid);
         OtpInputStream  ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         Assert.IsTrue(pid.Equals(ins.read_pid()));
     }
     {
         Erlang.Port     p   = new Erlang.Port("abc", 1, 2);
         OtpOutputStream os  = new OtpOutputStream(p);
         OtpInputStream  ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         Assert.IsTrue(p.Equals(ins.read_port()));
     }
     {
         Erlang.Ref p = new Erlang.Ref("abc", new int[3] {
             1, 2, 3
         }, 2);
         OtpOutputStream os  = new OtpOutputStream(p);
         OtpInputStream  ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         Assert.IsTrue(p.Equals(ins.read_ref()));
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_long(1);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         long           n   = ins.read_long();
         Assert.IsTrue(1 == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_long(0xFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         long           n   = ins.read_long();
         Assert.IsTrue(0xFFFFFF == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_long(0xFFFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         long           n   = ins.read_long();
         Assert.IsTrue(0xFFFFFFFF == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_ulong((ulong)0xFFFFFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         ulong          n   = ins.read_ulong();
         Assert.IsTrue((ulong)0xFFFFFFFFFF == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_ulong((ulong)0xFFFFFFFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         ulong          n   = ins.read_ulong();
         Assert.IsTrue((ulong)0xFFFFFFFFFFFF == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_ulong((ulong)0xFFFFFFFFFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         ulong          n   = ins.read_ulong();
         Assert.IsTrue((ulong)0xFFFFFFFFFFFFFF == n);
     }
     {
         OtpOutputStream os = new OtpOutputStream();
         os.write_ulong((ulong)0xFFFFFFFFFFFFFFFF);
         OtpInputStream ins = new OtpInputStream(os.getBuffer(), 0, os.size());
         ulong          n   = ins.read_ulong();
         Assert.IsTrue((ulong)0xFFFFFFFFFFFFFFFF == n);
     }
 }