Reputation: 4276
How can I get a FileInputStream
of an existing file which doesn't go through the whole file but rather goes through a specified part of the file (from byte m
till byte n
)?
Edit: I need the FileInputStream
to submit it to org.apache.commons.net.ftp.FTPClient.storeFile.
Upvotes: 1
Views: 320
Reputation:
File file = ...
FileInputStream fis = new FileInputStream(file);
long m = ....
fis.getChannel().position(m);
int n = ...
byte[] buffer = new byte[n];
fis.read(buffer);
Upvotes: 1