[英]Java: Calling InputStream.read with long offset and length parameters
When calling the read
method on an InputStream object, with the off
and len
arguments being long
s, it apparently can't do it: 当在off
和len
参数为long
s的情况下,在InputStream对象上调用read
方法时,显然不能这样做:
The method read(byte[], int, int) in the type InputStream is not applicable for the arguments (byte[], long, long)
Do I really have to read it in blocks then? 那我真的需要逐个阅读吗? Is there some easy fix? 有一些简单的解决方法吗? Why can't they just have an overload? 为什么他们不能只是超载?
As stated in the Java Language Specification 如Java语言规范中所述
Arrays must be indexed by
int
values; 数组必须通过int
值建立索引;short
,byte
, orchar
values may also be used as index values because they are subjected to unary numeric promotion (§5.6.1) and become int values.short
,byte
或char
值也可以用作索引值,因为它们经过一元数值提升(第5.6.1节)并成为int值。
Providing a byte[]
and a long
len
would simply not make sense. 提供byte[]
和long
len
根本没有意义。 No such API exists. 不存在这样的API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.