由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 关于char和int的问题
相关主题
怎么从键盘输入整数或float?怎样截取网页
中多个

之间的内容?
how to read from a non-return socket stream?问一个blocking IO的程序
从文件读入数据得到的是bytesjava,多层map应该怎么写?求个葫芦
关于 BufferedReader 问题新手求教 BufferedReader.readLine()
Process的问题问个io的问题
Java练习题 7read from multiple inputstreams at the same time?
JAVA文本文件读写问题help about bitstream writer
刚刚开始学习java,麻烦帮我看一下我哪里错了行吗?谢谢BufferedWriter里的write()
相关话题的讨论汇总
话题: byte话题: int话题: stream话题: read
进入Java版参与讨论
1 (共1页)
c*********n
发帖数: 128
1
今天写程序碰到一个问题, 搞清楚了,
但是由此想到之前在这里问的为什么write()参数为int c问题, 故来讨论一下
用InputStream的read()来从文件中读字节
read
public abstract int read()
throws IOException
Reads the next byte of data from the input stream. The value byte is
returned as an int in the range 0 to 255. If no byte is available because the
end of the stream has been reached, the value -1 is returned. This method
blocks until input data is available, the end of the stream is detected, or an
exception is thrown.
这里读的是byte却用int的形式
g*****g
发帖数: 34805
2
事实上很少有人直接用InputStream,如果处理文本可以
用BufferedReader,传送Object可以用ObjectInputStream,
真是处理视频之类的也可以用ByteArrayInputStream。

the
an

【在 c*********n 的大作中提到】
: 今天写程序碰到一个问题, 搞清楚了,
: 但是由此想到之前在这里问的为什么write()参数为int c问题, 故来讨论一下
: 用InputStream的read()来从文件中读字节
: read
: public abstract int read()
: throws IOException
: Reads the next byte of data from the input stream. The value byte is
: returned as an int in the range 0 to 255. If no byte is available because the
: end of the stream has been reached, the value -1 is returned. This method
: blocks until input data is available, the end of the stream is detected, or an

m******t
发帖数: 2416
3
Interesting theory. Makes sense to me.

the
an

【在 c*********n 的大作中提到】
: 今天写程序碰到一个问题, 搞清楚了,
: 但是由此想到之前在这里问的为什么write()参数为int c问题, 故来讨论一下
: 用InputStream的read()来从文件中读字节
: read
: public abstract int read()
: throws IOException
: Reads the next byte of data from the input stream. The value byte is
: returned as an int in the range 0 to 255. If no byte is available because the
: end of the stream has been reached, the value -1 is returned. This method
: blocks until input data is available, the end of the stream is detected, or an

1 (共1页)
进入Java版参与讨论
相关主题
BufferedWriter里的write()Process的问题
very weird problemJava练习题 7
what is your opinion in this case?JAVA文本文件读写问题
这段程序的输出是什么? 为什么刚刚开始学习java,麻烦帮我看一下我哪里错了行吗?谢谢
怎么从键盘输入整数或float?怎样截取网页
中多个

之间的内容?
how to read from a non-return socket stream?问一个blocking IO的程序
从文件读入数据得到的是bytesjava,多层map应该怎么写?求个葫芦
关于 BufferedReader 问题新手求教 BufferedReader.readLine()
相关话题的讨论汇总
话题: byte话题: int话题: stream话题: read