java 中File.length() 和InputStream.avalible()

1. File.length()

Returns the length of this file in bytes. Returns 0 if the file does not exist. The result for a directory is not defined.

2. InputStream.avalible()

Returns an estimated number of bytes that can be read or skipped without blocking for more input.

..It is particularly important to realize that you must not use this method to size a container and assume that you can read the entirety of the stream without needing to resize the container.

..if you're reading from a file, length() returns the current length of the file (though assuming the file's length can't change may be incorrect, reading a file is inherently racy).


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值