- java.lang.Object
-
- io.github.pixee.security.BoundedLineReader
-
public final class BoundedLineReader extends java.lang.Object
This type exposes helper methods to deal with protecting I/O operations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
readLine(java.io.Reader reader, int max)
This method reads until a newline is encountered or the specified number of characters is reached.
-
-
-
Method Detail
-
readLine
public static java.lang.String readLine(java.io.Reader reader, int max) throws java.io.IOException
This method reads until a newline is encountered or the specified number of characters is reached.This code originally came from the OWASP ESAPI project:
- Parameters:
reader
- the reader from which to read the linemax
- the maximum number of bytes to read for the given line read- Returns:
- the same as
BufferedReader.readLine()
would return - Throws:
java.io.IOException
- when the underlying reader errorsjava.lang.IllegalArgumentException
- if the line being read from the reader is greater than maxO- See Also:
- https://wiki.sei.cmu.edu/confluence/display/java/MSC05-J.+Do+not+exhaust+heap+space, https://github.com/vishank848/owasp-esapi-java/blob/master/src/main/java/org/owasp/esapi/reference/DefaultValidator.java
-
-