- 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();
-
-
-
- }
-
- }
相关文章:
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2021-07-11
-
2022-12-23
-
2022-12-23
-
2021-09-18
-
2022-02-12
猜你喜欢
-
2021-07-06
-
2021-12-07
-
2021-05-28
-
2022-12-23
-
2022-12-23
-
2021-09-29
相关资源
-
下载
2023-01-19
-
下载
2023-04-06
-
下载
2022-12-14