最赞回答 / 闲云野鹤2406
应为byte是有符号数这一行System.out.print(Integer.toHexString((buf[i])&0xff)+" ");还有这一行if ((buf[i]&0xff)<0xf)最后看老师明明输入了&0xff但是视频并没放出来
2015-04-05
System.out.println( new String( b ) );
is.close();
OutputStream os = new FileOutputStream( "D:/b.txt" );
os.write( b );
os.close();
is.close();
OutputStream os = new FileOutputStream( "D:/b.txt" );
os.write( b );
os.close();
2015-04-04
File atxt = new File( "D:/a.txt" );
InputStream is = new FileInputStream( atxt );
byte[] b = new byte[is.available()];
is.read( b );
int len = 0;
while ( ( len = is.read() ) != -1 ) {
is.read( b, 0, len );
}
System.out.println( new String( b ) );
is.close();
InputStream is = new FileInputStream( atxt );
byte[] b = new byte[is.available()];
is.read( b );
int len = 0;
while ( ( len = is.read() ) != -1 ) {
is.read( b, 0, len );
}
System.out.println( new String( b ) );
is.close();
2015-04-04
我觉得应该直接写 fr.read(buffer) 比 fr.read(buffer,0,buffer.length) 更好,感觉 buffer.length 是多余的
2015-03-30