Example #1
0
 /// <exception cref="System.IO.IOException"/>
 public override void ReadFields(BinaryReader reader)
 {
     base.ReadFields(@in);
     shortTestString        = @in.ReadUTF();
     longTestString         = WritableUtils.ReadString(@in);
     compressableTestString = WritableUtils.ReadCompressedString(@in);
     containedObject.ReadFields(@in);
     // Warning if this is a recursive call, you need a null value.
     testStringArray = WritableUtils.ReadStringArray(@in);
 }
Example #2
0
            public override void Run()
            {
                string           name = this.GetName();
                DataOutputBuffer @out = new DataOutputBuffer();
                DataInputBuffer  @in  = new DataInputBuffer();

                for (int i = 0; i < 1000; ++i)
                {
                    try
                    {
                        @out.Reset();
                        WritableUtils.WriteString(@out, name);
                        @in.Reset(@out.GetData(), @out.GetLength());
                        string s = WritableUtils.ReadString(@in);
                        Assert.Equal("input buffer reset contents = " + name, name, s);
                    }
                    catch (Exception ioe)
                    {
                        throw new RuntimeException(ioe);
                    }
                }
            }