java中的io流问题 FileInputStream中的read()返回的int类型是读取字节的
java中的io流问题FileInputStream中的read()返回的int类型是读取字节的ASCLL编码么?是一个一个字节读?BufferedInputStream...
java中的io流问题
FileInputStream中的read()返回的int类型是读取字节的ASCLL编码么?是一个一个字节读?
BufferedInputStream中的read()返回的是读入字节的长度吗?是一段一段的读吗?谢谢了,感觉好疑惑 展开
FileInputStream中的read()返回的int类型是读取字节的ASCLL编码么?是一个一个字节读?
BufferedInputStream中的read()返回的是读入字节的长度吗?是一段一段的读吗?谢谢了,感觉好疑惑 展开
3个回答
展开全部
FileInputStream是基础类,字节流,按字节读取。
BufferedInputStream是包装类,处理流,先将数据读于缓冲区,然后再读取
BufferedInputStream是包装类,处理流,先将数据读于缓冲区,然后再读取
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看源码啊,FileInputStream
/**
* Reads a byte of data from this input stream. This method blocks
* if no input is yet available.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* file is reached.
* @exception IOException if an I/O error occurs.
*/
public native int read() throws IOException;
BufferedInputStream
/**
* See
* the general contract of the <code>read</code>
* method of <code>InputStream</code>.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* stream is reached.
* @exception IOException if this input stream has been closed by
* invoking its {@link #close()} method,
* or an I/O error occurs.
* @see java.io.FilterInputStream#in
*/
public synchronized int read() throws IOException {
if (pos >= count) {
fill();
if (pos >= count)
return -1;
}
return getBufIfOpen()[pos++] & 0xff;
}
/**
* Reads a byte of data from this input stream. This method blocks
* if no input is yet available.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* file is reached.
* @exception IOException if an I/O error occurs.
*/
public native int read() throws IOException;
BufferedInputStream
/**
* See
* the general contract of the <code>read</code>
* method of <code>InputStream</code>.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* stream is reached.
* @exception IOException if this input stream has been closed by
* invoking its {@link #close()} method,
* or an I/O error occurs.
* @see java.io.FilterInputStream#in
*/
public synchronized int read() throws IOException {
if (pos >= count) {
fill();
if (pos >= count)
return -1;
}
return getBufIfOpen()[pos++] & 0xff;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询