Class CharSequenceReader

java.lang.Object
java.io.Reader
org.eclipse.lemminx.commons.CharSequenceReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class CharSequenceReader extends Reader
A Reader that reads from a CharSequence without requiring conversion to String. This avoids the memory cost of materializing a full String copy when the backing store is a StringBuilder.

Supports mark(int)/reset() for compatibility with parsers (e.g. Xerces) that may use mark/reset during encoding detection.

  • Constructor Details

    • CharSequenceReader

      public CharSequenceReader(CharSequence source)
  • Method Details

    • read

      public int read()
      Overrides:
      read in class Reader
    • read

      public int read(char[] cbuf, int off, int len)
      Specified by:
      read in class Reader
    • skip

      public long skip(long n)
      Overrides:
      skip in class Reader
    • ready

      public boolean ready()
      Overrides:
      ready in class Reader
    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class Reader
    • mark

      public void mark(int readAheadLimit)
      Overrides:
      mark in class Reader
    • reset

      public void reset()
      Overrides:
      reset in class Reader
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class Reader