如何开辟一个32K缓冲区?
我想每次从一个文件中取出32k的字串,存在String类型中,怎么办呢?
------解决方案--------------------byte[] b = new byte[32*1024];
------解决方案--------------------byte[] buf = new byte[32 * 1024];
DataInputStream di = new DataInputStream( new FileInputStream( "c:/test.txt " ) );
int num = -1;
String str = null;
while( ( num = di.read( buf ) ) != -1 ) {
str = new String( buf, 0 , num );
System.out.println( " num = " + num );
System.out.println( " str = " + str );
}
------解决方案--------------------study
------解决方案--------------------up
------解决方案--------------------up