Class StreamsReadersWriters.CaseChangeReader

java.lang.Object
java.io.Reader
java.io.FilterReader
eu.bandm.tools.util.StreamsReadersWriters.CaseChangeReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Enclosing class:
StreamsReadersWriters

public static class StreamsReadersWriters.CaseChangeReader extends FilterReader
Converts all characters read to lower or to upper. Uses methods from Character, thus ist is not localized. Does not treat supplementary characters (two Java-characters corresponding to one Unicode codepoint above 0x1_0000).
  • Field Details

    • toUpper

      final boolean toUpper
  • Constructor Details

    • CaseChangeReader

      public CaseChangeReader(Reader in, boolean toUpper)
      Only Constructor.
      Parameters:
      in - the predecessor in the filter chain = the Reader from which the data comes.
      toUpper - indicates whether convert to upper case, not to lower case.
  • Method Details

    • read

      public int read(char[] buf, int off, int len) throws IOException
      Overrides:
      read in class FilterReader
      Throws:
      IOException
    • read

      public int read() throws IOException
      Overrides:
      read in class FilterReader
      Throws:
      IOException
    • changeCase

      public char changeCase(char c)
      Do the change of the character case, according to the value in toUpper. Is calles for every character read from the input. Is public to be overridden by the user in case that more sophisticated character conversion is necessary.