/** * Note that this constructor will read everything from reader and will close it. */ protected CodeBuffer(Reader initialCodeReader, CodeReaderConfiguration configuration) { Reader reader = null; try { lastChar = -1; cursor = new Cursor(); tabWidth = configuration.getTabWidth(); /* Setup the filters on the reader */ reader = initialCodeReader; for (CodeReaderFilter<?> codeReaderFilter : configuration.getCodeReaderFilters()) { reader = new Filter(reader, codeReaderFilter, configuration); } buffer = IOUtils.toCharArray(reader); } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } finally { IOUtils.closeQuietly(reader); } }