<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FFile_Input_Output%2FChar_Reader_Writer</id>
		<title>Java/File Input Output/Char Reader Writer - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FFile_Input_Output%2FChar_Reader_Writer"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/Char_Reader_Writer&amp;action=history"/>
		<updated>2026-04-22T04:32:28Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/File_Input_Output/Char_Reader_Writer&amp;diff=6159&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/Char_Reader_Writer&amp;diff=6159&amp;oldid=prev"/>
				<updated>2010-06-01T06:02:59Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:02, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/File_Input_Output/Char_Reader_Writer&amp;diff=6158&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/Char_Reader_Writer&amp;diff=6158&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Char Array IO ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.io.CharArrayReader;&lt;br /&gt;
import java.io.CharArrayWriter;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
public class CharArrayIOApp {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    CharArrayWriter outStream = new CharArrayWriter();&lt;br /&gt;
    String s = &amp;quot;This is a test.&amp;quot;;&lt;br /&gt;
    for (int i = 0; i &amp;lt; s.length(); ++i)&lt;br /&gt;
      outStream.write(s.charAt(i));&lt;br /&gt;
    System.out.println(&amp;quot;outstream: &amp;quot; + outStream);&lt;br /&gt;
    System.out.println(&amp;quot;size: &amp;quot; + outStream.size());&lt;br /&gt;
    CharArrayReader inStream;&lt;br /&gt;
    inStream = new CharArrayReader(outStream.toCharArray());&lt;br /&gt;
    int ch = 0;&lt;br /&gt;
    StringBuffer sb = new StringBuffer(&amp;quot;&amp;quot;);&lt;br /&gt;
    while ((ch = inStream.read()) != -1)&lt;br /&gt;
      sb.append((char) ch);&lt;br /&gt;
    s = sb.toString();&lt;br /&gt;
    System.out.println(s.length() + &amp;quot; characters were read&amp;quot;);&lt;br /&gt;
    System.out.println(&amp;quot;They are: &amp;quot; + s);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demonstrate CharArrayWriter. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.io.CharArrayWriter;&lt;br /&gt;
import java.io.FileWriter;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
class CharArrayWriterDemo {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    CharArrayWriter f = new CharArrayWriter();&lt;br /&gt;
    String s = &amp;quot;This should end up in the array&amp;quot;;&lt;br /&gt;
    char buf[] = new char[s.length()];&lt;br /&gt;
    s.getChars(0, s.length(), buf, 0);&lt;br /&gt;
    f.write(buf);&lt;br /&gt;
    System.out.println(f.toString());&lt;br /&gt;
    char c[] = f.toCharArray();&lt;br /&gt;
    for (int i = 0; i &amp;lt; c.length; i++) {&lt;br /&gt;
      System.out.print(c[i]);&lt;br /&gt;
    }&lt;br /&gt;
    FileWriter f2 = new FileWriter(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
    f.writeTo(f2);&lt;br /&gt;
    f2.close();&lt;br /&gt;
    f.reset();&lt;br /&gt;
    for (int i = 0; i &amp;lt; 3; i++)&lt;br /&gt;
      f.write(&amp;quot;X&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Safe UTF: 64K serialized size ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
  * JBoss, Home of Professional Open Source&lt;br /&gt;
  * Copyright 2005, JBoss Inc., and individual contributors as indicated&lt;br /&gt;
  * by the @authors tag. See the copyright.txt in the distribution for a&lt;br /&gt;
  * full listing of individual contributors.&lt;br /&gt;
  *&lt;br /&gt;
  * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
  * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
  * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
  * the License, or (at your option) any later version.&lt;br /&gt;
  *&lt;br /&gt;
  * This software is distributed in the hope that it will be useful,&lt;br /&gt;
  * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
  * Lesser General Public License for more details.&lt;br /&gt;
  *&lt;br /&gt;
  * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
  * License along with this software; if not, write to the Free&lt;br /&gt;
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
  */&lt;br /&gt;
import java.io.DataInputStream;&lt;br /&gt;
import java.io.DataOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 * A SafeUTF&lt;br /&gt;
 * &lt;br /&gt;
 * @author &lt;br /&gt;
 * @version $Revision: 1174 $&lt;br /&gt;
 *&lt;br /&gt;
 * $Id: SafeUTF.java 1174 2006-08-02 14:14:32Z timfox $&lt;br /&gt;
 * &lt;br /&gt;
 * There is a &amp;quot;bug&amp;quot; in JDK1.4 / 1.5 DataOutputStream.writeUTF()&lt;br /&gt;
 * which means it does not work with Strings &amp;gt;= 64K serialized size.&lt;br /&gt;
 * See http://bugs.sun.ru/bugdatabase/view_bug.do?bug_id=4806007&lt;br /&gt;
 * &lt;br /&gt;
 * We work around this by chunking larger strings into smaller pieces.&lt;br /&gt;
 * &lt;br /&gt;
 * Note we only support TextMessage and ObjectMessage bodies with serialized length &amp;gt;= 64K&lt;br /&gt;
 * We DO NOT support Strings written to BytesMessages or StreamMessages or written as keys or values&lt;br /&gt;
 * in MapMessages, or as String properties or other String fields having serialized length &amp;gt;= 64K&lt;br /&gt;
 * This is for performance reasons since there is an overhead in coping with large&lt;br /&gt;
 * Strings&lt;br /&gt;
 * &lt;br /&gt;
 */&lt;br /&gt;
public class SafeUTF&lt;br /&gt;
{      &lt;br /&gt;
   //Default is 16K chunks&lt;br /&gt;
   private static final int CHUNK_SIZE = 16 * 1024;&lt;br /&gt;
   &lt;br /&gt;
   private static final byte NULL = 0;&lt;br /&gt;
   &lt;br /&gt;
   private static final byte NOT_NULL = 1;&lt;br /&gt;
   &lt;br /&gt;
   public static SafeUTF instance = new SafeUTF(CHUNK_SIZE);&lt;br /&gt;
   &lt;br /&gt;
   private int chunkSize;&lt;br /&gt;
   &lt;br /&gt;
   private int lastReadBufferSize;&lt;br /&gt;
   &lt;br /&gt;
   public int getLastReadBufferSize()&lt;br /&gt;
   {&lt;br /&gt;
      return lastReadBufferSize;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   public SafeUTF(int chunkSize)&lt;br /&gt;
   {&lt;br /&gt;
      this.chunkSize = chunkSize;&lt;br /&gt;
   }&lt;br /&gt;
      &lt;br /&gt;
   public void safeWriteUTF(DataOutputStream out, String str) throws IOException&lt;br /&gt;
   {        &lt;br /&gt;
      if (str == null)&lt;br /&gt;
      {&lt;br /&gt;
         out.writeByte(NULL);&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {         &lt;br /&gt;
         int len = str.length();&lt;br /&gt;
          &lt;br /&gt;
         short numChunks;&lt;br /&gt;
         &lt;br /&gt;
         if (len == 0)&lt;br /&gt;
         {&lt;br /&gt;
            numChunks = 0;&lt;br /&gt;
         }&lt;br /&gt;
         else&lt;br /&gt;
         {&lt;br /&gt;
            numChunks = (short)(((len - 1) / chunkSize) + 1);&lt;br /&gt;
         }         &lt;br /&gt;
         &lt;br /&gt;
         out.writeByte(NOT_NULL);&lt;br /&gt;
         &lt;br /&gt;
         out.writeShort(numChunks);&lt;br /&gt;
              &lt;br /&gt;
         int i = 0;&lt;br /&gt;
         while (len &amp;gt; 0)&lt;br /&gt;
         {&lt;br /&gt;
            int beginCopy = i * chunkSize;&lt;br /&gt;
            &lt;br /&gt;
            int endCopy = len &amp;lt;= chunkSize ? beginCopy + len : beginCopy + chunkSize;&lt;br /&gt;
     &lt;br /&gt;
            String theChunk = str.substring(beginCopy, endCopy);&lt;br /&gt;
               &lt;br /&gt;
            out.writeUTF(theChunk);&lt;br /&gt;
            &lt;br /&gt;
            len -= chunkSize;&lt;br /&gt;
            &lt;br /&gt;
            i++;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   public String safeReadUTF(DataInputStream in) throws IOException&lt;br /&gt;
   {   &lt;br /&gt;
      boolean isNull = in.readByte() == NULL;&lt;br /&gt;
      &lt;br /&gt;
      if (isNull)&lt;br /&gt;
      {&lt;br /&gt;
         return null;&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      short numChunks = in.readShort();&lt;br /&gt;
      &lt;br /&gt;
      int bufferSize = chunkSize * numChunks;&lt;br /&gt;
      &lt;br /&gt;
      // special handling for single chunk&lt;br /&gt;
      if (numChunks == 1)&lt;br /&gt;
      {&lt;br /&gt;
         // The text size is likely to be much smaller than the chunkSize&lt;br /&gt;
         // so set bufferSize to the min of the input stream available&lt;br /&gt;
         // and the maximum buffer size. Since the input stream&lt;br /&gt;
         // available() can be &amp;lt;= 0 we check for that and default to&lt;br /&gt;
         // a small msg size of 256 bytes.&lt;br /&gt;
         &lt;br /&gt;
         int inSize = in.available();&lt;br /&gt;
               &lt;br /&gt;
         if (inSize &amp;lt;= 0)&lt;br /&gt;
         {&lt;br /&gt;
            inSize = 256;&lt;br /&gt;
         }&lt;br /&gt;
         bufferSize = Math.min(inSize, bufferSize);&lt;br /&gt;
         &lt;br /&gt;
         lastReadBufferSize = bufferSize;&lt;br /&gt;
      }&lt;br /&gt;
        &lt;br /&gt;
      StringBuffer buff = new StringBuffer(bufferSize);&lt;br /&gt;
            &lt;br /&gt;
      for (int i = 0; i &amp;lt; numChunks; i++)&lt;br /&gt;
      {&lt;br /&gt;
         String s = in.readUTF();&lt;br /&gt;
         buff.append(s);&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      return buff.toString();&lt;br /&gt;
   }&lt;br /&gt;
      &lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== uses a pair of CharArrayReaders ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.io.CharArrayReader;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
public class CharArrayReaderDemo {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    String tmp = &amp;quot;abcdefghijklmnopqrstuvwxyz&amp;quot;;&lt;br /&gt;
    int length = tmp.length();&lt;br /&gt;
    char c[] = new char[length];&lt;br /&gt;
    tmp.getChars(0, length, c, 0);&lt;br /&gt;
    CharArrayReader input1 = new CharArrayReader(c);&lt;br /&gt;
    CharArrayReader input2 = new CharArrayReader(c, 0, 5);&lt;br /&gt;
    int i;&lt;br /&gt;
    while ((i = input1.read()) != -1) {&lt;br /&gt;
      System.out.print((char) i);&lt;br /&gt;
    }&lt;br /&gt;
    while ((i = input2.read()) != -1) {&lt;br /&gt;
      System.out.print((char) i);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UTF8 Reader ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.Reader;&lt;br /&gt;
import java.io.UTFDataFormatException;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * @author Andy Clark, IBM&lt;br /&gt;
 *&lt;br /&gt;
 * @version $Id: UTF8Reader.java 515 2008-03-17 21:02:23Z jfrederic.clere@jboss.ru $&lt;br /&gt;
 */&lt;br /&gt;
public class UTF8Reader&lt;br /&gt;
    extends Reader {&lt;br /&gt;
    &lt;br /&gt;
    //&lt;br /&gt;
    // Constants&lt;br /&gt;
    //&lt;br /&gt;
    /** Default byte buffer size (2048). */&lt;br /&gt;
    public static final int DEFAULT_BUFFER_SIZE = 2048;&lt;br /&gt;
    // debugging&lt;br /&gt;
    /** Debug read. */&lt;br /&gt;
    private static final boolean DEBUG_READ = false;&lt;br /&gt;
    //&lt;br /&gt;
    // Data&lt;br /&gt;
    //&lt;br /&gt;
    /** Input stream. */&lt;br /&gt;
    protected InputStream fInputStream;&lt;br /&gt;
    /** Byte buffer. */&lt;br /&gt;
    protected byte[] fBuffer;&lt;br /&gt;
    /** Offset into buffer. */&lt;br /&gt;
    protected int fOffset;&lt;br /&gt;
    /** Surrogate character. */&lt;br /&gt;
    private int fSurrogate = -1;&lt;br /&gt;
    //&lt;br /&gt;
    // Constructors&lt;br /&gt;
    //&lt;br /&gt;
    /** &lt;br /&gt;
     * Constructs a UTF-8 reader from the specified input stream, &lt;br /&gt;
     * buffer size and MessageFormatter.&lt;br /&gt;
     *&lt;br /&gt;
     * @param inputStream The input stream.&lt;br /&gt;
     * @param size        The initial buffer size.&lt;br /&gt;
     */&lt;br /&gt;
    public UTF8Reader(InputStream inputStream, int size) {&lt;br /&gt;
        fInputStream = inputStream;&lt;br /&gt;
        fBuffer = new byte[size];&lt;br /&gt;
    }&lt;br /&gt;
    //&lt;br /&gt;
    // Reader methods&lt;br /&gt;
    //&lt;br /&gt;
    /**&lt;br /&gt;
     * Read a single character.  This method will block until a character is&lt;br /&gt;
     * available, an I/O error occurs, or the end of the stream is reached.&lt;br /&gt;
     *&lt;br /&gt;
     * &amp;lt;p&amp;gt; Subclasses that intend to support efficient single-character input&lt;br /&gt;
     * should override this method.&lt;br /&gt;
     *&lt;br /&gt;
     * @return     The character read, as an integer in the range 0 to 16383&lt;br /&gt;
     *             (&amp;lt;tt&amp;gt;0x00-0xffff&amp;lt;/tt&amp;gt;), or -1 if the end of the stream has&lt;br /&gt;
     *             been reached&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If an I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public int read() throws IOException {&lt;br /&gt;
        // decode character&lt;br /&gt;
        int c = fSurrogate;&lt;br /&gt;
        if (fSurrogate == -1) {&lt;br /&gt;
            // NOTE: We use the index into the buffer if there are remaining&lt;br /&gt;
            //       bytes from the last block read. -Ac&lt;br /&gt;
            int index = 0;&lt;br /&gt;
            // get first byte&lt;br /&gt;
            int b0 = index == fOffset &lt;br /&gt;
                   ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
            if (b0 == -1) {&lt;br /&gt;
                return -1;&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [0xxx xxxx]&lt;br /&gt;
            // Unicode: [0000 0000] [0xxx xxxx]&lt;br /&gt;
            if (b0 &amp;lt; 0x80) {&lt;br /&gt;
                c = (char)b0;&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [110y yyyy] [10xx xxxx]&lt;br /&gt;
            // Unicode: [0000 0yyy] [yyxx xxxx]&lt;br /&gt;
            else if ((b0 &amp;amp; 0xE0) == 0xC0) {&lt;br /&gt;
                int b1 = index == fOffset &lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b1 == -1) {&lt;br /&gt;
                    expectedByte(2, 2);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(2, 2, b1);&lt;br /&gt;
                }&lt;br /&gt;
                c = ((b0 &amp;lt;&amp;lt; 6) &amp;amp; 0x07C0) | (b1 &amp;amp; 0x003F);&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [1110 zzzz] [10yy yyyy] [10xx xxxx]&lt;br /&gt;
            // Unicode: [zzzz yyyy] [yyxx xxxx]&lt;br /&gt;
            else if ((b0 &amp;amp; 0xF0) == 0xE0) {&lt;br /&gt;
                int b1 = index == fOffset&lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b1 == -1) {&lt;br /&gt;
                    expectedByte(2, 3);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(2, 3, b1);&lt;br /&gt;
                }&lt;br /&gt;
                int b2 = index == fOffset &lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b2 == -1) {&lt;br /&gt;
                    expectedByte(3, 3);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b2 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(3, 3, b2);&lt;br /&gt;
                }&lt;br /&gt;
                c = ((b0 &amp;lt;&amp;lt; 12) &amp;amp; 0xF000) | ((b1 &amp;lt;&amp;lt; 6) &amp;amp; 0x0FC0) |&lt;br /&gt;
                    (b2 &amp;amp; 0x003F);&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]*&lt;br /&gt;
            // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate)&lt;br /&gt;
            //          [1101 11yy] [yyxx xxxx] (low surrogate)&lt;br /&gt;
            //          * uuuuu = wwww + 1&lt;br /&gt;
            else if ((b0 &amp;amp; 0xF8) == 0xF0) {&lt;br /&gt;
                int b1 = index == fOffset &lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b1 == -1) {&lt;br /&gt;
                    expectedByte(2, 4);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(2, 3, b1);&lt;br /&gt;
                }&lt;br /&gt;
                int b2 = index == fOffset &lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b2 == -1) {&lt;br /&gt;
                    expectedByte(3, 4);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b2 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(3, 3, b2);&lt;br /&gt;
                }&lt;br /&gt;
                int b3 = index == fOffset &lt;br /&gt;
                       ? fInputStream.read() : fBuffer[index++] &amp;amp; 0x00FF;&lt;br /&gt;
                if (b3 == -1) {&lt;br /&gt;
                    expectedByte(4, 4);&lt;br /&gt;
                }&lt;br /&gt;
                if ((b3 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    invalidByte(4, 4, b3);&lt;br /&gt;
                }&lt;br /&gt;
                int uuuuu = ((b0 &amp;lt;&amp;lt; 2) &amp;amp; 0x001C) | ((b1 &amp;gt;&amp;gt; 4) &amp;amp; 0x0003);&lt;br /&gt;
                if (uuuuu &amp;gt; 0x10) {&lt;br /&gt;
                    invalidSurrogate(uuuuu);&lt;br /&gt;
                }&lt;br /&gt;
                int wwww = uuuuu - 1;&lt;br /&gt;
                int hs = 0xD800 | &lt;br /&gt;
                         ((wwww &amp;lt;&amp;lt; 6) &amp;amp; 0x03C0) | ((b1 &amp;lt;&amp;lt; 2) &amp;amp; 0x003C) | &lt;br /&gt;
                         ((b2 &amp;gt;&amp;gt; 4) &amp;amp; 0x0003);&lt;br /&gt;
                int ls = 0xDC00 | ((b2 &amp;lt;&amp;lt; 6) &amp;amp; 0x03C0) | (b3 &amp;amp; 0x003F);&lt;br /&gt;
                c = hs;&lt;br /&gt;
                fSurrogate = ls;&lt;br /&gt;
            }&lt;br /&gt;
            // error&lt;br /&gt;
            else {&lt;br /&gt;
                invalidByte(1, 1, b0);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        // use surrogate&lt;br /&gt;
        else {&lt;br /&gt;
            fSurrogate = -1;&lt;br /&gt;
        }&lt;br /&gt;
        return c;&lt;br /&gt;
    } // read():int&lt;br /&gt;
    /**&lt;br /&gt;
     * Read characters into a portion of an array.  This method will block&lt;br /&gt;
     * until some input is available, an I/O error occurs, or the end of the&lt;br /&gt;
     * stream is reached.&lt;br /&gt;
     *&lt;br /&gt;
     * @param      ch     Destination buffer&lt;br /&gt;
     * @param      offset Offset at which to start storing characters&lt;br /&gt;
     * @param      length Maximum number of characters to read&lt;br /&gt;
     *&lt;br /&gt;
     * @return     The number of characters read, or -1 if the end of the&lt;br /&gt;
     *             stream has been reached&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If an I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public int read(char ch[], int offset, int length) throws IOException {&lt;br /&gt;
        // handle surrogate&lt;br /&gt;
        int out = offset;&lt;br /&gt;
        if (fSurrogate != -1) {&lt;br /&gt;
            ch[offset + 1] = (char)fSurrogate;&lt;br /&gt;
            fSurrogate = -1;&lt;br /&gt;
            length--;&lt;br /&gt;
            out++;&lt;br /&gt;
        }&lt;br /&gt;
        // read bytes&lt;br /&gt;
        int count = 0;&lt;br /&gt;
        if (fOffset == 0) {&lt;br /&gt;
            // adjust length to read&lt;br /&gt;
            if (length &amp;gt; fBuffer.length) {&lt;br /&gt;
                length = fBuffer.length;&lt;br /&gt;
            }&lt;br /&gt;
            // perform read operation&lt;br /&gt;
            count = fInputStream.read(fBuffer, 0, length);&lt;br /&gt;
            if (count == -1) {&lt;br /&gt;
                return -1;&lt;br /&gt;
            }&lt;br /&gt;
            count += out - offset;&lt;br /&gt;
        }&lt;br /&gt;
        // skip read; last character was in error&lt;br /&gt;
        // NOTE: Having an offset value other than zero means that there was&lt;br /&gt;
        //       an error in the last character read. In this case, we have&lt;br /&gt;
        //       skipped the read so we don&amp;quot;t consume any bytes past the &lt;br /&gt;
        //       error. By signalling the error on the next block read we&lt;br /&gt;
        //       allow the method to return the most valid characters that&lt;br /&gt;
        //       it can on the previous block read. -Ac&lt;br /&gt;
        else {&lt;br /&gt;
            count = fOffset;&lt;br /&gt;
            fOffset = 0;&lt;br /&gt;
        }&lt;br /&gt;
        // convert bytes to characters&lt;br /&gt;
        final int total = count;&lt;br /&gt;
        for (int in = 0; in &amp;lt; total; in++) {&lt;br /&gt;
            int b0 = fBuffer[in] &amp;amp; 0x00FF;&lt;br /&gt;
            // UTF-8:   [0xxx xxxx]&lt;br /&gt;
            // Unicode: [0000 0000] [0xxx xxxx]&lt;br /&gt;
            if (b0 &amp;lt; 0x80) {&lt;br /&gt;
                ch[out++] = (char)b0;&lt;br /&gt;
                continue;&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [110y yyyy] [10xx xxxx]&lt;br /&gt;
            // Unicode: [0000 0yyy] [yyxx xxxx]&lt;br /&gt;
            if ((b0 &amp;amp; 0xE0) == 0xC0) {&lt;br /&gt;
                int b1 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b1 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b1 = fInputStream.read();&lt;br /&gt;
                    if (b1 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fOffset = 1;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(2, 2);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fOffset = 2;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(2, 2, b1);&lt;br /&gt;
                }&lt;br /&gt;
                int c = ((b0 &amp;lt;&amp;lt; 6) &amp;amp; 0x07C0) | (b1 &amp;amp; 0x003F);&lt;br /&gt;
                ch[out++] = (char)c;&lt;br /&gt;
                count -= 1;&lt;br /&gt;
                continue;&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [1110 zzzz] [10yy yyyy] [10xx xxxx]&lt;br /&gt;
            // Unicode: [zzzz yyyy] [yyxx xxxx]&lt;br /&gt;
            if ((b0 &amp;amp; 0xF0) == 0xE0) {&lt;br /&gt;
                int b1 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b1 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b1 = fInputStream.read();&lt;br /&gt;
                    if (b1 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fOffset = 1;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(2, 3);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fOffset = 2;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(2, 3, b1);&lt;br /&gt;
                }&lt;br /&gt;
                int b2 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b2 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b2 = fInputStream.read();&lt;br /&gt;
                    if (b2 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fBuffer[1] = (byte)b1;&lt;br /&gt;
                            fOffset = 2;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(3, 3);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b2 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fBuffer[2] = (byte)b2;&lt;br /&gt;
                        fOffset = 3;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(3, 3, b2);&lt;br /&gt;
                }&lt;br /&gt;
                int c = ((b0 &amp;lt;&amp;lt; 12) &amp;amp; 0xF000) | ((b1 &amp;lt;&amp;lt; 6) &amp;amp; 0x0FC0) |&lt;br /&gt;
                        (b2 &amp;amp; 0x003F);&lt;br /&gt;
                ch[out++] = (char)c;&lt;br /&gt;
                count -= 2;&lt;br /&gt;
                continue;&lt;br /&gt;
            }&lt;br /&gt;
            // UTF-8:   [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]*&lt;br /&gt;
            // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate)&lt;br /&gt;
            //          [1101 11yy] [yyxx xxxx] (low surrogate)&lt;br /&gt;
            //          * uuuuu = wwww + 1&lt;br /&gt;
            if ((b0 &amp;amp; 0xF8) == 0xF0) {&lt;br /&gt;
                int b1 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b1 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b1 = fInputStream.read();&lt;br /&gt;
                    if (b1 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fOffset = 1;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(2, 4);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b1 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fOffset = 2;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(2, 4, b1);&lt;br /&gt;
                }&lt;br /&gt;
                int b2 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b2 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b2 = fInputStream.read();&lt;br /&gt;
                    if (b2 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fBuffer[1] = (byte)b1;&lt;br /&gt;
                            fOffset = 2;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(3, 4);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b2 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fBuffer[2] = (byte)b2;&lt;br /&gt;
                        fOffset = 3;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(3, 4, b2);&lt;br /&gt;
                }&lt;br /&gt;
                int b3 = -1;&lt;br /&gt;
                if (++in &amp;lt; total) { &lt;br /&gt;
                    b3 = fBuffer[in] &amp;amp; 0x00FF; &lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    b3 = fInputStream.read();&lt;br /&gt;
                    if (b3 == -1) {&lt;br /&gt;
                        if (out &amp;gt; offset) {&lt;br /&gt;
                            fBuffer[0] = (byte)b0;&lt;br /&gt;
                            fBuffer[1] = (byte)b1;&lt;br /&gt;
                            fBuffer[2] = (byte)b2;&lt;br /&gt;
                            fOffset = 3;&lt;br /&gt;
                            return out - offset;&lt;br /&gt;
                        }&lt;br /&gt;
                        expectedByte(4, 4);&lt;br /&gt;
                    }&lt;br /&gt;
                    count++;&lt;br /&gt;
                }&lt;br /&gt;
                if ((b3 &amp;amp; 0xC0) != 0x80) {&lt;br /&gt;
                    if (out &amp;gt; offset) {&lt;br /&gt;
                        fBuffer[0] = (byte)b0;&lt;br /&gt;
                        fBuffer[1] = (byte)b1;&lt;br /&gt;
                        fBuffer[2] = (byte)b2;&lt;br /&gt;
                        fBuffer[3] = (byte)b3;&lt;br /&gt;
                        fOffset = 4;&lt;br /&gt;
                        return out - offset;&lt;br /&gt;
                    }&lt;br /&gt;
                    invalidByte(4, 4, b2);&lt;br /&gt;
                }&lt;br /&gt;
                // decode bytes into surrogate characters&lt;br /&gt;
                int uuuuu = ((b0 &amp;lt;&amp;lt; 2) &amp;amp; 0x001C) | ((b1 &amp;gt;&amp;gt; 4) &amp;amp; 0x0003);&lt;br /&gt;
                if (uuuuu &amp;gt; 0x10) {&lt;br /&gt;
                    invalidSurrogate(uuuuu);&lt;br /&gt;
                }&lt;br /&gt;
                int wwww = uuuuu - 1;&lt;br /&gt;
                int zzzz = b1 &amp;amp; 0x000F;&lt;br /&gt;
                int yyyyyy = b2 &amp;amp; 0x003F;&lt;br /&gt;
                int xxxxxx = b3 &amp;amp; 0x003F;&lt;br /&gt;
                int hs = 0xD800 | ((wwww &amp;lt;&amp;lt; 6) &amp;amp; 0x03C0) | (zzzz &amp;lt;&amp;lt; 2) | (yyyyyy &amp;gt;&amp;gt; 4);&lt;br /&gt;
                int ls = 0xDC00 | ((yyyyyy &amp;lt;&amp;lt; 6) &amp;amp; 0x03C0) | xxxxxx;&lt;br /&gt;
                // set characters&lt;br /&gt;
                ch[out++] = (char)hs;&lt;br /&gt;
                ch[out++] = (char)ls;&lt;br /&gt;
                count -= 2;&lt;br /&gt;
                continue;&lt;br /&gt;
            }&lt;br /&gt;
            // error&lt;br /&gt;
            if (out &amp;gt; offset) {&lt;br /&gt;
                fBuffer[0] = (byte)b0;&lt;br /&gt;
                fOffset = 1;&lt;br /&gt;
                return out - offset;&lt;br /&gt;
            }&lt;br /&gt;
            invalidByte(1, 1, b0);&lt;br /&gt;
        }&lt;br /&gt;
        return count;&lt;br /&gt;
    } // read(char[],int,int)&lt;br /&gt;
    /**&lt;br /&gt;
     * Skip characters.  This method will block until some characters are&lt;br /&gt;
     * available, an I/O error occurs, or the end of the stream is reached.&lt;br /&gt;
     *&lt;br /&gt;
     * @param  n  The number of characters to skip&lt;br /&gt;
     *&lt;br /&gt;
     * @return    The number of characters actually skipped&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If an I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public long skip(long n) throws IOException {&lt;br /&gt;
        long remaining = n;&lt;br /&gt;
        final char[] ch = new char[fBuffer.length];&lt;br /&gt;
        do {&lt;br /&gt;
            int length = ch.length &amp;lt; remaining ? ch.length : (int)remaining;&lt;br /&gt;
            int count = read(ch, 0, length);&lt;br /&gt;
            if (count &amp;gt; 0) {&lt;br /&gt;
                remaining -= count;&lt;br /&gt;
            }&lt;br /&gt;
            else {&lt;br /&gt;
                break;&lt;br /&gt;
            }&lt;br /&gt;
        } while (remaining &amp;gt; 0);&lt;br /&gt;
        long skipped = n - remaining;&lt;br /&gt;
        return skipped;&lt;br /&gt;
    } // skip(long):long&lt;br /&gt;
    /**&lt;br /&gt;
     * Tell whether this stream is ready to be read.&lt;br /&gt;
     *&lt;br /&gt;
     * @return True if the next read() is guaranteed not to block for input,&lt;br /&gt;
     * false otherwise.  Note that returning false does not guarantee that the&lt;br /&gt;
     * next read will block.&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If an I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public boolean ready() throws IOException {&lt;br /&gt;
      return false;&lt;br /&gt;
    } // ready()&lt;br /&gt;
    /**&lt;br /&gt;
     * Tell whether this stream supports the mark() operation.&lt;br /&gt;
     */&lt;br /&gt;
    public boolean markSupported() {&lt;br /&gt;
      return false;&lt;br /&gt;
    } // markSupported()&lt;br /&gt;
    /**&lt;br /&gt;
     * Mark the present position in the stream.  Subsequent calls to reset()&lt;br /&gt;
     * will attempt to reposition the stream to this point.  Not all&lt;br /&gt;
     * character-input streams support the mark() operation.&lt;br /&gt;
     *&lt;br /&gt;
     * @param  readAheadLimit  Limit on the number of characters that may be&lt;br /&gt;
     *                         read while still preserving the mark.  After&lt;br /&gt;
     *                         reading this many characters, attempting to&lt;br /&gt;
     *                         reset the stream may fail.&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If the stream does not support mark(),&lt;br /&gt;
     *                          or if some other I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public void mark(int readAheadLimit) throws IOException {&lt;br /&gt;
  throw new IOException(&amp;quot;operationNotSupported&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Reset the stream.  If the stream has been marked, then attempt to&lt;br /&gt;
     * reposition it at the mark.  If the stream has not been marked, then&lt;br /&gt;
     * attempt to reset it in some way appropriate to the particular stream,&lt;br /&gt;
     * for example by repositioning it to its starting point.  Not all&lt;br /&gt;
     * character-input streams support the reset() operation, and some support&lt;br /&gt;
     * reset() without supporting mark().&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If the stream has not been marked,&lt;br /&gt;
     *                          or if the mark has been invalidated,&lt;br /&gt;
     *                          or if the stream does not support reset(),&lt;br /&gt;
     *                          or if some other I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public void reset() throws IOException {&lt;br /&gt;
        fOffset = 0;&lt;br /&gt;
        fSurrogate = -1;&lt;br /&gt;
    } // reset()&lt;br /&gt;
    /**&lt;br /&gt;
     * Close the stream.  Once a stream has been closed, further read(),&lt;br /&gt;
     * ready(), mark(), or reset() invocations will throw an IOException.&lt;br /&gt;
     * Closing a previously-closed stream, however, has no effect.&lt;br /&gt;
     *&lt;br /&gt;
     * @exception  IOException  If an I/O error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public void close() throws IOException {&lt;br /&gt;
        fInputStream.close();&lt;br /&gt;
    } // close()&lt;br /&gt;
    //&lt;br /&gt;
    // Private methods&lt;br /&gt;
    //&lt;br /&gt;
    /** Throws an exception for expected byte. */&lt;br /&gt;
    private void expectedByte(int position, int count)&lt;br /&gt;
        throws UTFDataFormatException {&lt;br /&gt;
        throw new UTFDataFormatException(&amp;quot;expectedByte&amp;quot;);&lt;br /&gt;
    } // expectedByte(int,int,int)&lt;br /&gt;
    /** Throws an exception for invalid byte. */&lt;br /&gt;
    private void invalidByte(int position, int count, int c) &lt;br /&gt;
        throws UTFDataFormatException {&lt;br /&gt;
        throw new UTFDataFormatException(&amp;quot;invalidByte&amp;quot;);&lt;br /&gt;
    } // invalidByte(int,int,int,int)&lt;br /&gt;
    /** Throws an exception for invalid surrogate bits. */&lt;br /&gt;
    private void invalidSurrogate(int uuuuu) throws UTFDataFormatException {&lt;br /&gt;
        &lt;br /&gt;
        throw new UTFDataFormatException(&amp;quot;invalidHighSurrogate&amp;quot;);&lt;br /&gt;
    } // invalidSurrogate(int)&lt;br /&gt;
} // class UTF8Reader&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>