Are there any circumstances where FileChannel.size()
and File.length()
will be different? Please see the code example below:
File file = new File(name);
FileInputStream stream = new FileInputStream(file);
FileChannel channel = stream.getChannel();
long channel_size = channel.size();
long file_length = file.length();