/** * Skip length and open input stream. */ public InputStream openInputStream(FtpIoSession session, FtpFile file, long skipLen) throws IOException { InputStream in; if (session.getDataType() == DataType.ASCII) { int c; long offset = 0L; in = new BufferedInputStream(file.createInputStream(0L)); while (offset++ < skipLen) { if ((c = in.read()) == -1) { throw new IOException("Cannot skip"); } if (c == '\n') { offset++; } } } else { in = file.createInputStream(skipLen); } return in; }
is = file.createInputStream(0); String md5Hash = md5(is);