### Question:
IOUtils { public static String getReaderAsString(Reader reader, int maxLen) throws IOException { Objects.requireNonNull(reader, "reader cannot be null"); StringBuilder sb = new StringBuilder(); char[] buffer = new char[2048]; int read; int count = 0; while ((read = reader.read(buffer)) > -1) { count += read; if (maxLen > -1 && count > maxLen) { throw new IllegalArgumentException(XLog.format("stream exceeds limit [{0}]", maxLen)); } sb.append(buffer, 0, read); } reader.close(); return sb.toString(); }  static void delete(File file); static String getReaderAsString(Reader reader, int maxLen); static InputStream getResourceAsStream(String path, int maxLen); static Reader getResourceAsReader(String path, int maxLen); static String getResourceAsString(String path, int maxLen); static void copyStream(InputStream is, OutputStream os); static void copyCharStream(Reader reader, Writer writer); static void zipDir(File dir, String relativePath, ZipOutputStream zos); static File createJar(File baseDir, String jarName, Class... classes); static void closeSafely(Closeable... objects);  }### Answer:
@Test public void testGetReaderAsString() throws IOException { try { IOUtils.getReaderAsString(new StringReader("1234"), 2); fail(); } catch (IllegalArgumentException ex) { } assertEquals("1234", IOUtils.getReaderAsString(new StringReader("1234"), 4)); }