0
有沒有什麼情況下channel_size和file_length會不同?請參閱下面的代碼示例:Java Channel.size()vs File.length
File file = new File(name);
FileInputStream stream = new FileInputStream(file);
FileChannel channel = stream.getChannel();
long channel_size = channel.size();
long file_length = file.length();
爲什麼不打印出這兩個值並查看它們是否不同? –
@JoshM我認爲OP正在尋找他們不會的情況。 –