in src/main/java/com/pastdev/jsch/nio/file/UnixSshFileSystemProvider.java [465:485]
int read( UnixSshPath path, long startIndex, ByteBuffer bytes ) throws IOException {
int read = 0;
ChannelExecWrapper sshChannel = path.getFileSystem().getCommandRunner().open(
path.getFileSystem().getCommand( "dd" )
+ " bs=1 skip=" + startIndex + " if="
+ path.toAbsolutePath().quotedString() + " 2> /dev/null");
try (InputStream in = sshChannel.getInputStream()) {
ReadableByteChannel inChannel = Channels.newChannel( in );
int localRead;
while (bytes.hasRemaining() && (localRead = inChannel.read( bytes )) > 0) {
read += localRead;
}
}
finally {
int exitCode = sshChannel.close();
if ( exitCode != 0 ) {
throw new IOException( "dd failed " + exitCode );
}
}
return read;
}