Class LimitedLineLengthReader

java.lang.Object
java.io.Reader
edu.uky.cs.nil.tt.LimitedLineLengthReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class LimitedLineLengthReader extends Reader
A Reader which throws an exception if it reads more than a certain number of characters before encountering an end of line. This reader is used to secure other IO utilities like BufferedReader which read whole lines of input at a time. Malicious users could cause problems such as OutOfMemoryError by sending long streams of information without a new line character.
Author:
Stephen G. Ware
  • Constructor Details

    • LimitedLineLengthReader

      public LimitedLineLengthReader(Reader reader, int limit)
      Wraps a new limited line length reader around a given reader and with the given limit on line length.
      Parameters:
      reader - the reader from which characters will be read
      limit - the number of characters which may be read before an end of line character
  • Method Details