コード例 #1
0
        //-------------------------------------------------------------------------
//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);
        }