text: public virtual byte[] ToByteArray(){if (buf != null){byte[] r = new byte[ptr];System.Array.Copy(buf, 0, r, 0, ptr);return r;}try{return overflowBuffer.ToByteArray();}catch (IOException err){throw new RuntimeException(err);}}