gpt4 book ai didi

java - 说一个方法读取一个字节的数据是什么意思?

转载 作者:行者123 更新时间:2023-11-30 05:51:00 25 4
gpt4 key购买 nike

<分区>

我正在通过 java.io.RandomAccessFile 的 oracle API类(class)。

类中有一个名为 read() 的方法,它从传递给构造函数的文件中读取字节数据:-

public int read() throws IOException

Reads a byte of data from this file. The byte is returned as an integer in the range 0 to 255 (0x00-0x0ff). This method blocks if no input is yet available.

Although RandomAccessFile is not a subclass of InputStream, this method behaves in exactly the same way as the InputStream.read() method of InputStream.

Returns: the next byte of data, or -1 if the end of the file has been reached. Throws: IOException - if an I/O error occurs. Not thrown if end-of-file has been reached.

我很疑惑,是不是说它从传递给构造函数的文件中读取8位数据,并将读取的内容转换为int。

有什么建议吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com