-
bufferedinputStream操作
- import java.io.BufferedInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
-
-
- public class BufferedInputStreamTest {
-
- public static void main(String[] args) throws IOException {
- File file = new File("c:\\mm.txt");
- FileInputStream fis = new FileInputStream(file);
- BufferedInputStream bis = new BufferedInputStream(fis);
-
- byte[] contents = new byte[1024];
- int byteRead = 0;
- String strFileContents;
-
- try {
- while((byteRead = bis.read(contents)) != -1){
- strFileContents = new String(contents,0,byteRead);
- System.out.println(strFileContents);
- }
- } catch (IOException e) {
-
- e.printStackTrace();
- }
- bis.close();
- }
-
- }
- import java.io.BufferedInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
-
-
- public class ReadFileTest {
-
- public static void main(String[] args) throws IOException {
- File file = new File("c:\\mm.txt");
- FileInputStream fis = new FileInputStream(file);
- BufferedInputStream bis = new BufferedInputStream(fis);
-
- while(bis.available() > 0){
- System.out.print((char)bis.read());
- }
- bis.close();
- }
-
- }
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
-
-
- public class BufferedInputStreamCopyFile {
-
- public static void main(String[] args) throws IOException {
- BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:\\电影\\sn.ts"));
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("d:\\电影sn1.ts"));
-
- int i;
-
- do{
- i = bis.read();
- if(i != -1){
- bos.write(i);
- }
- }while(i != -1);
-
- bis.close();
- bos.close();
-
-
-
- }
-
- }
-
相关阅读:
win7无法访问2003共享的解决方法(转)
nokia vcf文件导入iphone(转)
zblog之密码修改
vs2010 dump 调试
T400 CTO 突遇windows update当前无法检查更新,因为服务为运行。您可能需要重新启动计算机!
练手卦,奖金何时发?
QUdpSocket 4.6 严重丢包
修行
占问事宜:我买的择日书籍何时能到?
Silverlight 5 Beta新特性[6]低延迟对WAV格式声音效果支持
-
原文地址:https://www.cnblogs.com/fuccc/p/5698705.html
Copyright © 2020-2023
润新知