title: Read text file from position in Java
body: <p>I need to read char[] (size is COUNT) from text file from OFFSET with specified Charset. COUNT and OFFSET are in characters, not in bytes.
  He is my code:</p>
  
  <pre><code>raf = new RandomAccessFile(filePath, "r");      
  if ((mBuffer == null) || (mBuffer.length &lt; count)) {
      mBuffer = new byte[(int)(count/mDecoder.averageCharsPerByte())];
      mByteWrap = ByteBuffer.wrap(mBuffer);
      mCharBuffer = new char[count];
      mCharWrap = CharBuffer.wrap(mCharBuffer);
  }
  try {
      offset = (int)(offset/mDecoder.averageCharsPerByte());
      count = (int)(count/mDecoder.averageCharsPerByte());
      raf.seek(offset);
      raf.read(mBuffer,0,count);
      mByteWrap.position(0);
      mCharWrap.position(0);
      mDecoder.decode(mByteWrap, mCharWrap, true);
  } catch (IOException e) {
      return null;
  }
  return mCharBuffer;
  </code></pre>
  
  <p><strong>Is there any way easier ? (without manual matching char->byte)</strong></p>
  
  <p>I was looking about java.util.Scanner, but it's Iterator-style, and i need random access-style.</p>
  
  <p>PS data should'n be copied many times</p>