Esempio n. 1
0
        /// <summary>
        /// The object implements the writeExternal method to save its contents
        /// by calling the methods of DataOutput for its primitive values or
        /// calling the writeObject method of ObjectOutput for objects, strings
        /// and arrays. </summary>
        /// <exception cref="IOException"> Includes any I/O exceptions that may occur </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
        public virtual void WriteExternal(ObjectOutput @out)
        {
            String s = ToString();             // contains ASCII chars only

            // one-to-one correspondence between ASCII char and byte in UTF string
            if (s.Length() <= 65535)             // 65535 is max length of UTF string
            {
                @out.WriteUTF(s);
            }
            else
            {
                @out.WriteByte(0);
                @out.WriteByte(0);
                @out.WriteInt(s.Length());
                @out.Write(s.Bytes);
            }
        }
Esempio n. 2
0
 public void Write(byte[] b)
 {
     dataOutput.Write(b);
 }