@Override public int read() throws IOException { if (currentStream == null) { if (index < constituents.length) { currentStream = constituents[index++].getInputStream(); } else { return -1; } } int b = currentStream.read(); if (b == -1) { currentStream = null; return read(); } return b; } };
@Override public int read() throws IOException { if (currentStream == null) { if (index < constituents.length) { currentStream = constituents[index++].getInputStream(); } else { return -1; } } int b = currentStream.read(); if (b == -1) { currentStream = null; return read(); } return b; } };
protected File getLocalFile(SourceModule M) throws IOException { if (M instanceof SourceFileModule) { return ((SourceFileModule) M).getFile(); } else { File f = File.createTempFile("module", ".txt"); f.deleteOnExit(); TemporaryFile.streamToFile(f, M.getInputStream()); return f; } }
protected File getLocalFile(SourceModule M) throws IOException { if (M instanceof SourceFileModule) { return ((SourceFileModule) M).getFile(); } else { File f = File.createTempFile("module", ".txt"); f.deleteOnExit(); TemporaryFile.streamToFile(f, M.getInputStream()); return f; } }
@Override public int read(char[] cbuf, int off, int len) throws IOException { if (currentReader == null) { if (index < constituents.length) { currentName = constituents[index].getURL(); currentReader = new LineNumberReader(new InputStreamReader(constituents[index++].getInputStream())); } else { return -1; } } int x; if ((x = currentReader.read(cbuf, off, len)) == -1) { line += currentReader.getLineNumber(); locations.add(Pair.make(line, currentName)); currentReader.close(); currentReader = null; return read(cbuf, off, len); } return x; }
@Override public int read(char[] cbuf, int off, int len) throws IOException { if (currentReader == null) { if (index < constituents.length) { currentName = constituents[index].getURL(); currentReader = new LineNumberReader(new InputStreamReader(constituents[index++].getInputStream())); } else { return -1; } } int x; if ((x = currentReader.read(cbuf, off, len)) == -1) { line += currentReader.getLineNumber(); locations.add(Pair.make(line, currentName)); currentReader.close(); currentReader = null; return read(cbuf, off, len); } return x; }