//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toString_bomUtf8() throws java.io.IOException
        public virtual void test_toString_bomUtf8()
        {
            sbyte[] bytes = new sbyte[] { unchecked ((sbyte)0xEF), unchecked ((sbyte)0xBB), unchecked ((sbyte)0xBF), (sbyte)'H', (sbyte)'e', (sbyte)'l', (sbyte)'l', (sbyte)'o' };
            string  str   = UnicodeBom.ToString(bytes);

            assertEquals(str, "Hello");
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toString_bomUtf16LE() throws java.io.IOException
        public virtual void test_toString_bomUtf16LE()
        {
            sbyte[] bytes = new sbyte[] { X_FF, X_FE, (sbyte)'H', X_00, (sbyte)'e', X_00, (sbyte)'l', X_00, (sbyte)'l', X_00, (sbyte)'o', X_00 };
            string  str   = UnicodeBom.ToString(bytes);

            assertEquals(str, "Hello");
        }
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toString_noBomUtf8() throws java.io.IOException
        public virtual void test_toString_noBomUtf8()
        {
            sbyte[] bytes = new sbyte[] { (sbyte)'H', (sbyte)'e', (sbyte)'l', (sbyte)'l', (sbyte)'o' };
            string  str   = UnicodeBom.ToString(bytes);

            assertEquals(str, "Hello");
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toReader_noBomUtf8() throws java.io.IOException
        public virtual void test_toReader_noBomUtf8()
        {
            sbyte[] bytes  = new sbyte[] { (sbyte)'H', (sbyte)'e', (sbyte)'l', (sbyte)'l', (sbyte)'o' };
            Reader  reader = UnicodeBom.toReader(new MemoryStream(bytes));
            string  str    = CharStreams.ToString(reader);

            assertEquals(str, "Hello");
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toReader_notBomUtf16LE() throws java.io.IOException
        public virtual void test_toReader_notBomUtf16LE()
        {
            sbyte[] bytes  = new sbyte[] { X_00, X_FE, (sbyte)'M', (sbyte)'P' };
            Reader  reader = UnicodeBom.toReader(new MemoryStream(bytes));
            string  str    = CharStreams.ToString(reader);

            assertEquals(str, StringHelper.NewString(bytes, StandardCharsets.UTF_8));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toReader_bomUtf16LE_short() throws java.io.IOException
        public virtual void test_toReader_bomUtf16LE_short()
        {
            sbyte[] bytes  = new sbyte[] { X_FF, X_FE };
            Reader  reader = UnicodeBom.toReader(new MemoryStream(bytes));
            string  str    = CharStreams.ToString(reader);

            assertEquals(str, "");
        }
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toReader_bomUtf16LE() throws java.io.IOException
        public virtual void test_toReader_bomUtf16LE()
        {
            sbyte[] bytes  = new sbyte[] { X_FF, X_FE, (sbyte)'H', X_00, (sbyte)'e', X_00, (sbyte)'l', X_00, (sbyte)'l', X_00, (sbyte)'o', X_00 };
            Reader  reader = UnicodeBom.toReader(new MemoryStream(bytes));
            string  str    = CharStreams.ToString(reader);

            assertEquals(str, "Hello");
        }
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_toCharSource_noBomUtf8() throws java.io.IOException
        public virtual void test_toCharSource_noBomUtf8()
        {
            sbyte[]    bytes      = new sbyte[] { (sbyte)'H', (sbyte)'e', (sbyte)'l', (sbyte)'l', (sbyte)'o' };
            ByteSource byteSource = ByteSource.wrap(bytes);
            CharSource charSource = UnicodeBom.toCharSource(byteSource);
            string     str        = charSource.read();

            assertEquals(str, "Hello");
            assertEquals(charSource.asByteSource(StandardCharsets.UTF_8), byteSource);
            assertEquals(charSource.ToString().StartsWith("UnicodeBom", StringComparison.Ordinal), true);
        }
 /// <summary>
 /// Reads the source, converting to UTF-8 using a Byte-Order Mark if available.
 /// </summary>
 /// <returns> the UTF-8 string </returns>
 public string readUtf8UsingBom()
 {
     return(UnicodeBom.ToString(array));
 }