Exemplo n.º 1
0
            /// <exception cref="System.IO.IOException"/>
            public override void Write(BinaryWriter writer)
            {
                base.Write(@out);
                @out.WriteUTF(shortTestString);
                WritableUtils.WriteString(@out, longTestString);
                int comp = WritableUtils.WriteCompressedString(@out, compressableTestString);

                System.Console.Out.WriteLine("Compression is " + comp + "%");
                containedObject.Write(@out);
                // Warning if this is a recursive call, you need a null value.
                WritableUtils.WriteStringArray(@out, testStringArray);
            }
Exemplo n.º 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);
                    }
                }
            }