数据输出流/内存操作流/打印流/随机访问流/序列化和反序列化/属性集合(Properties)/SequenceInputStream

2020.5.30 课堂笔记

数据输入输出流

  1. DateInputStream数据输入流: 构造方法:DataInputStream(InputStream in).
  2. DateOutputStream数据输出流:构造方法:DataOutputStream(OutputStream out).
  3. 可以读写java的基本数据类型,是将基本类型的数据读取到字节数组中
  4. 输出到文件里面的信息可能是乱码,可以通过读取在窗口显示。
  5. 因此在读取数据时要保持顺序一致,即输出的是Boolean类型,输入也要布尔类型。

代码

package org.westos.demo1;
 
/*Author:LH
CreatTime:2020.05.30.18:21*/

//数据输入/输出流的测试
import java.io.*;

public class Test1 {
    public static void main(String[] args) throws IOException {
//        使用数据输入输出流,来操作基本类型数据
        DataOutputStream out = new DataOutputStream(new FileOutputStream("data.txt"));
//        输出基本类型的时候就要采用基本类型的输出方法
        out.writeInt(34);
        out.writeBoolean(false);
        out.writeChar('A');
        out.writeUTF("我爱你,你知道吗");
        out.close();
        DataInputStream in = new DataInputStream(new FileInputStream("data.txt"));
//        数据输入流读取文件的时候,要按照输出的基本类型顺序读取,不然就会报错。
        int i = in.readInt();
        System.out.println(i);
        System.out.println(in.readBoolean());
        System.out.println(in.readChar());
        String s = in.readUTF();
        System.out.println(s);
        in.close();
    }
}

内存操作流

  1. 分为三种:

    • 字节数组操作流

      它自己维护了一个字节数组,默认容量32,还可以自己扩容。只能读取字节数组,

      • ByteArrayOutputStream:使用toByteArray()获得数据。
        • ByteArrayOutputStream() 创建一个新的 byte 数组输出流。
        • ByteArrayOutputStream(int size) 创建一个新的 byte 数组输出流,它具有指定大小的缓冲区容量(以字节为单位)。
      • ByteArrayInputStream
        • ByteArrayInputStream(byte[] buf, int offset, int length):要将输出的数组传递进来,可以指定起始位置和长度。
        • ByteArrayInputStream(byte[] buf):要将输出的数组传递进来。
    • 字符数组操作流:

      • CharArrayWrite:可用作write的字符缓冲区,将字符输出到缓冲区,缓冲区随着字符输出的多少自动增加。可使用toCharArray() 和 toString() 获取数据。
        • CharArrayWriter()
        • CharArrayWriter(int initialSize)
      • CharArrayReader:从字符数组中读取数据到新的字符数组中。
        • CharArrayReader(char[] buf)
        • CharArrayReader(char[] buf, int offset, int length)
    • 字符串操作流

      • StringWriter
      • StringReader
  2. 不会直接关联文件,只是在内存中进行数据的读写。

  3. 它最好的利用方式是:两个及其以上文件的合并和一个文件复制多次,

package org.westos.demo1;
 
/*Author:LH
CreatTime:2020.05.30.18:48*/

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
//内存操作流--字节操作流
public class Test2 {
    public static void main(String[] args) throws IOException {
//        先将字节输出到维护的字节数组中,
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        out.write("做人先修身".getBytes());
//        获取维护的字节数组
        byte[] bytes = out.toByteArray();
        out.close();
//        将获取到的字节数组传入到输入流。
        ByteArrayInputStream in = new ByteArrayInputStream(bytes);
//        创建一个字节数组,从输入流维护的数组中读到此数组中,
        byte[] bytes1 = new byte[3];
        int len=0;
        String l="";
        while ((len=in.read(bytes1))!=-1){
            String s = new String(bytes1);
           l+=s;
        }
//        in.read(bytes1);
        System.out.println(l);
        in.close();

    }
}
--.package org.westos.demo1;
 
/*Author:LH
CreatTime:2020.05.30.22:58*/

import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.IOException;
//内存操作流---字符数组流
public class Test3 {
    public static void main(String[] args) throws IOException {
        CharArrayWriter out = new CharArrayWriter();
        String s="穷则独善其身";
        char[] chars = s.toCharArray();
        out.write(chars);
        out.append('a');
        out.append("达则兼济天下");
        char[] chars1 = out.toCharArray();
        CharArrayReader in = new CharArrayReader(chars1);
        char[] chars2 = new char[1000];
        in.read(chars2);
        String s1 = String.valueOf(chars2);
        System.out.println(s1);

    }
}
--.package org.westos.demo1;

import java.io.*;

/*Author:LH
CreatTime:2020.05.30.23:11*/
//一个文件的多次复制
public class Test4 {
    public static void main(String[] args) throws IOException {
        FileInputStream in = new FileInputStream("a.mp3");
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        byte[] bytes = new byte[1024 * 8];
        int len = 0;
//        将文件读到缓冲区
        while ((len = in.read(bytes)) != -1) {
            byteOut.write(bytes, 0, len);
        }
        in.close();
//        一定要获取到缓冲区的数组
        byte[] bytes2 = byteOut.toByteArray();
        byte[] bytes1 = new byte[1024 * 8];
        int len2 = 0;
        FileOutputStream out1 = new FileOutputStream("C:\\Users\\LH\\Desktop\\a1.mp3");
        FileOutputStream out2 = new FileOutputStream("C:\\Users\\LH\\Desktop\\a2.mp3");
        FileOutputStream out3 = new FileOutputStream("C:\\Users\\LH\\Desktop\\a3.mp3");
        ByteArrayInputStream byteIn = new ByteArrayInputStream(bytes2);
//        从缓冲区获取数组到新的数组并输出
        while ((len2 = byteIn.read(bytes1)) != -1) {
            out1.write(bytes1, 0, len2);
        }
//        每次都需要新创建一个内存操作输入流
        byteIn = new ByteArrayInputStream(bytes2);
        while ((len2 = byteIn.read(bytes1)) != -1) {
            out2.write(bytes1, 0, len2);
        }
        byteIn = new ByteArrayInputStream(bytes2);
        while ((len2 = byteIn.read(bytes1)) != -1) {
            out3.write(bytes1, 0, len2);
        }
        out1.close();
        out2.close();
        out3.close();
    }
}

打印流

字符打印流和字节打印流。

  1. 字符打印流(PrintWriter):

    • 特有的打印方法

      • append(char c):在其尾部添加指定字符
      • append(String s):将指定的字符串添加到打印流中
      • append(String s, int start, int end):将指定的字符串,子序列添加到打印流
    • 自动刷新:

      • 下列这两种方法会启动自动刷新,autoFlush - boolean 变量;如果为 true,则
        println、printf 或 format 方法将刷新输出缓冲区

      • PrintWriter(OutputStream out, boolean autoFlush)

      • PrintWriter(Writer out, boolean autoFlush)

    • 自动刷新的特点:

      • 不是所有的方法都会自动刷新,当使用自动刷新时,print()就不会自动刷新,需要手动刷新
      • 只有三个方法可以自动刷新: println、printf 或 format 方法将刷新输出缓冲区

    案例:

    package org.westos.demo2; 
     
    /*Author:LH
    CreatTime:2020.06.03.9:32*/
    
    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.io.UnsupportedEncodingException;
    //打印流的测试
    public class Test {
        public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
    //        指定编码类型,进行字符编码
            PrintWriter printWriter = new PrintWriter("print.txt", "GBK");
            printWriter.println(false);
            printWriter.println(true);
            printWriter.println(100);
            printWriter.flush();
            printWriter.close();
        }
    }
    --.package org.westos.demo2; 
     
    /*Author:LH
    CreatTime:2020.06.03.10:26*/
    
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    
    public class Test3 {
        public static void main(String[] args) throws IOException {
            PrintWriter printWriter = new PrintWriter(new FileWriter("printwriter.txt"), true);
            printWriter.append("我是巨无霸");
            printWriter.println(123);
    //        虽然开启了自动刷新,但是由于自动刷新用于println、printf 或 format这三个方法,不会自动刷新其他方法
            printWriter.print(false);
            printWriter.print('A');
    //        其他方法需要手动刷新
            printWriter.flush();
            printWriter.close();
        }
    }
    
  2. 字节打印流(PrintStream)

    • 打印到文件:打印到文件的字节打印流和字符打印流类似(自动刷新方法、特点和构造方法都类似)
  3. public static final InputStream in:标准输入流,System.in的数据类型数InputStream。对应的是键盘。

package org.westos.demo2; 
 
/*Author:LH
CreatTime:2020.06.03.12:36*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*in是一个字节输入流对象,那么我们就可以通过这个字节输入流对象进行读取键盘录入的数据.
	 * 那么我们既然要读取数据,之前我们讲解了两种读取数据的方式:
	 * 	1. 一次读取一个字节
	 * 	2. 一次读取一个字节数组
	 *那么我们在这个地方使用那种读取方式. 经过分析,这两种读取方式都不太合适.因为数据是客户通过键盘录入
	 *进来的,而我们希望直接读取一行数据. 而既然要读取一行数据,那么我们就需要使用readLine方法,而这个方法
	 *是属于BufferedReader的方法,而我们就需要创建一个BufferedReader对象进行读取数据.而我们这in有属于
	 *字节流,而创建BufferedReader对象的时候需要一个字符流,而我们就需要将这个字节流转换成字符流,那么既然
	 * 要对其进行转换,那么就需要使用转换流. 需要使用InputStreamReader
	 */

//从键盘输入的第二中方法,一次读取一行,因为 BufferedReader特有的方法readLine可以读取一行
//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));可以通过此方法构建标准输入流

public class Test6 {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("请输入内容");
        String s = in.readLine();
        System.out.println(s);
        
//        第一种就是Scanner从键盘读取数据
    }
}
  1. public static final PrintStream out:标准输出流,System.out的数据类型数PrintStream。对应的是显示器。
package org.westos.demo2; 
 
/*Author:LH
CreatTime:2020.06.03.11:56*/
//标准输出流的本质
import java.io.PrintStream;

public class Test5 {
    public static void main(String[] args) {
//   public static final PrintStream out = null;
//        out是标准输出流,对应的是电脑显示器。是System类中的标准输出流静态字段。
        PrintStream out = System.out;
        out.println("你好呀,猴腮类");
        out.println(100);
        out.println('a');
//        System.out.println();和上面创建的对象调方法类似,
    }
}

随机访问流(RandomAccessFile)

  1. 此类的实例支持对随机访问文件的读取和写入。随机访问文件的行为类似存储在文件系统中的一个大型 byte
    数组。存在指向该隐含数组的光标或索引。
  2. 最大特点,能读能写,有一个文件指针,可以控制文件指针位置。可以从文件中读写基本类型的数据,
  3. 通过获取和设置文件指针位置,可以反复读取文件。
  4. 断点下载文件
package org.westos.demo01;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Scanner;

/*Author:LH
CreatTime:2020.06.01.15:31*/

//断点文件,继续下载,
public class Test7 {
    public static void main(String[] args) throws IOException {
        File file = new File("a.mp3");
//        创建文件随机访问流的输入流
        RandomAccessFile rw = new RandomAccessFile(file, "rw");
//        创建文件随机访问流的输出流
        RandomAccessFile write = new RandomAccessFile("duandian.mp3", "rw");
        byte[] bytes = new byte[1024 * 8];
        int len = 0;
        int flag = 100;
//        认为创造随机断点
        try {
            while ((len = rw.read(bytes)) != -1) {
                write.write(bytes, 0, len);
                System.out.println(2 / (flag--));
            }
        } catch (Exception e) {
//            如果文件复制中断,那就输出指针位置
            System.out.println(rw.getFilePointer());
        }
//        模拟第二次重启的断点位置读取
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入断点位置");
        long num = sc.nextLong();
        rw.seek(num);
//        继续读取文件,复制
        while ((len = rw.read(bytes)) != -1) {
            write.write(bytes, 0, len);
        }
    }
}
  1. 复制文件
package org.westos.demo01; 
 
/*Author:LH
CreatTime:2020.06.01.14:32*/

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;

public class Test6 {
    public static void main(String[] args) throws IOException {
        File file = new File("C:\\Users\\LH\\Desktop\\day22.md");
        RandomAccessFile rw = new RandomAccessFile(file, "rw");
        byte[] bytes = new byte[1024 * 8];

//        将第一行读10次
       int i=1;
       while (i++<10){
           String s1 = rw.readLine();
           System.out.println(s1);
           rw.seek(0);
           System.out.println("=========");
           }
        System.out.println("++++++++++++++++++++");
//        将文件复制3次到显示屏
        int len = 0;
        int k = 1;
        while (k++ < 4) {
            while ((len = rw.read(bytes)) != -1) {
                String s = new String(bytes);
                System.out.println(s);
            }
            rw.seek(0);
            System.out.println("==========");
        }

//将一个文件复制三份到指定位置
        byte[] bytes1 = new byte[1024];
        int len2 = 0;
        int m = 1;
        File file1 = new File("C:\\Users\\LH\\Desktop");
        String name = file.getName();
        while (m < 4) {
            while ((len2 = rw.read(bytes1)) != -1) {
                String newName = m+name;
                File file2 = new File(file1, newName);
                FileOutputStream out = new FileOutputStream(file2,true);
                out.write(bytes1, 0, len2);
            }
            m++;
            rw.seek(0);
        }
        rw.close();
    }
}

系列化和反序列化

  1. 序列化< ObjectOutputStream >:将Java对象保存在文件中。

    • ObjectOutputStream(OutputStream out):需要一个字节输出流对象。
  2. 反序列化< ObjectInputStream >:将文件中的对象,读取回内存。

    • ObjectInputStream(InputStream in):需要一个字节输入流对象。
  3. 序列化时,就会给一个标记,在反序列化时,也会给一个标记(public static final long serialVersionUID=100L😉,会将两个标记对比,相同则不报错,如果修改了对象的代码,就会标记不相同,就会报错

    • 如果可序列化的类未明确声明serialVersionUID,则序列化运行时将根据类的各个方面为该类计算默认的serialVersionUID值,如Java™对象序列化规范中所述。但是强烈建议所有可序列化的类显式声明SerialVersionUID值,因为默认的serialVersionUID计算对类细节高度敏感,具体取决于编译器的实现,因此可能导致反序列化期间发生意外的,为了保证在不同的Java编译器实现中一致的serialVersionUID值,可序列化的类必须声明一个显式的serialVersionUID值。但是对于数组类,无需匹serialVersionUID值。

    • 解决方法,就是实现了接口之后,将SerialVersionUID值显式声明,将标记锁定,修改就不会报错

  4. 对某些字段不需要序列化:使用transient关键字。

  5. 存多个对象时,写和读。只需要其中一个对象时。

    • 解决方法,将多个对象存到集合中,然后再取出来。

代码演示

package org.westos.demo3; 
 
/*Author:LH
CreatTime:2020.06.03.14:51*/

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;

public class Test3 {
    public static void main(String[] args) throws IOException {
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("student.txt"));
       /* out.writeObject(new Student("李华",23));
        out.writeObject(new Student("张伟",24));
        out.writeObject(new Student("琳琳",25));
        out.flush();
        out.close();*/

//        我们要将几个对象序列化,那就先将对象存在集合中,然后将集合序列化
        Student s1 = new Student("李华",23,"男");
        Student s2 = new Student("张伟",24,"女");
        Student s3 = new Student("琳琳",25,"女");
        ArrayList<Student> list = new ArrayList<>();
        list.add(s1);
        list.add(s2);
        list.add(s3);
        out.writeObject(list);
        out.flush();
        out.close();

    }
}


class Student implements Serializable {
//    默认状态下的serialVersionUID如果此类被修改,反序列化的时候,就会报异常Exception in thread "main" java.io.InvalidClassException
//    将 serialVersionUID 显性化并赋值,就不会出现这现象
public static final long serialVersionUID=100L;
    private  String name;
    private  int  age;
//    不愿意被序列化的就是用 transient修饰,修饰完了就不能被序列化。
    private transient String sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Student(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }

}

package org.westos.demo3; 
 
/*Author:LH
CreatTime:2020.06.03.14:58*/

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;


//Exception in thread "main" java.io.InvalidClassException: 如果序列化的对象类被修改了,会出现这样的报错。
public class Test4 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream in = new ObjectInputStream(new FileInputStream("student.txt"));
        /*Student o = (Student) in.readObject();
        System.out.println(o.toString());
        Student o1 = (Student) in.readObject();
        System.out.println(o1.toString());
        Student o2 = (Student) in.readObject();
        System.out.println(o2.toString());*/

//        反序列化,得到集合,然后遍历集合
        ArrayList list = (ArrayList) in.readObject();
        for (Object o : list) {
            Student s= (Student) o;
            System.out.println(s.toString());
        }
        in.close();
    }
}

  1. 可以深克隆。

实现了cloneable接口的只是浅克隆

代码演示

package org.westos.demo3;

import java.io.*;

/*Author:LH
CreatTime:2020.06.03.23:13*/
//深克隆
public class Test5 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("teacher.txt"));
        out.writeObject(new Teacher("李文玲",23,new Person("陕西","西安外国语")));
        out.writeObject(new Teacher("张村花",25,new Person("河北","河北工业")));
        out.writeObject(new Teacher("李慧",29,new Person("河北","华北理工")));
//        由于此处是深克隆,因此在反序列化时,可以将对象里面存的地址指向的对象序列化和反序列化。
        ObjectInputStream in = new ObjectInputStream(new FileInputStream("teacher.txt"));
        Teacher o = (Teacher) in.readObject();
        String s = o.getName() + o.getAge() + o.getS().toString();
        System.out.println(s);
    }
}

class Teacher implements Serializable {
    static final long serialVersionUID = 100L;
    private  String name;
    private  int age;
    private  Person s;

    public Teacher(String name, int age, Person s) {
        this.name = name;
        this.age = age;
        this.s = s;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Person getS() {
        return s;
    }

    public void setS(Person s) {
        this.s = s;
    }
}


class Person implements Serializable{
    private String province;
    private String university;

    public Person(String province, String university) {
        this.province = province;
        this.university = university;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getUniversity() {
        return university;
    }

    public void setUniversity(String university) {
        this.university = university;
    }

    @Override
    public String toString() {
        return "Person{" +
                "province='" + province + '\'' +
                ", university='" + university + '\'' +
                '}';
    }
}

属性集合(Properties)

  1. 继承自hashtable,是一个双链集合。经常使用这个集合来读取配置文件。Properties类表示了一个持久的属性集。Properties可保存在流中或从流中加载。属性列表中每个键及其对应值都是一个字符串。
  2. 规定了键和值都是String类型。不用写泛型。
  3. 推荐使用它特有的方法。
  4. 把双列集合中的数据存到文本文件中保存。
package org.westos.demo4; 
 
/*Author:LH
CreatTime:2020.06.03.23:44*/

import java.io.*;
import java.util.Properties;
import java.util.Set;

public class Test {
    public static void main(String[] args) throws IOException {
//        相当于创建了一个双列集合,只是集合的泛型只能是String类型
        Properties properties = new Properties();
//       相当于put方法
        properties.setProperty("s001", "lihui");
        properties.setProperty("s002", "蒋大为");
        properties.setProperty("s003", "马伊俐");
//        相当于get方法
        String s1 = properties.getProperty("s001");
        System.out.println(s1);
        String s2 = properties.getProperty("s002");
        System.out.println(s2);
        String s3 = properties.getProperty("s003");
        System.out.println(s3);
//        将配置文件永久保存到文件中
        properties.list(new PrintStream(new FileOutputStream("peizhi.property")));
//    获取配置文件的键集合
        Set<String> set = properties.stringPropertyNames();
        for (String s : set) {
            System.out.println(s+"==="+properties.getProperty(s));
        }
//        读配置文件,并显示在屏幕
        Properties properties1 = new Properties();
        properties1.load(new FileInputStream("peizhi.property"));
        Set<String> strings = properties1.stringPropertyNames();
        for (String string : strings) {
            System.out.println(string+"=="+properties1.getProperty(string));
        }
    }
}

SequenceInputStream

  1. 表示其他输入流的逻辑串联。它从输入流的有序集合开始,并从第一个输入流开始读取,直到到达文件末尾,接着从第二个输入流读取,依次类推,直到到达包含的最后一个输入流的文件末尾为止。
  2. 构造方法: SequenceInputStream(InputStream s1, InputStream s2):表示将两个输入流逻辑关联。

代码

package org.westos.demo5; 
 
/*Author:LH
CreatTime:2020.06.05.10:44*/

import java.io.*;
//使用顺序流合并两个文件
public class Test {
    public static void main(String[] args) throws IOException {
        SequenceInputStream in = new SequenceInputStream(new FileInputStream("a.mp3"), new FileInputStream("b.mp3"));
        FileOutputStream out = new FileOutputStream("new.mp3");
        byte[] bytes = new byte[1024 * 8];
        int len=-1;
       while( (len=in.read(bytes))!=-1){
           out.write(bytes,0,len);
       }
       in.close();
       out.close();
    }
}
--.package org.westos.demo5;

import java.io.*;

/*Author:LH
CreatTime:2020.06.05.10:54*/
//使用序列流合并三个文件
public class Test2 {
    public static void main(String[] args) throws IOException {
        SequenceInputStream in1 = new SequenceInputStream(new FileInputStream("Test1.java"), new FileInputStream("Test2.java"));
        SequenceInputStream in2 = new SequenceInputStream(in1, new FileInputStream("Test3.java"));
        FileOutputStream out = new FileOutputStream("AllTest.java");
        byte[] bytes = new byte[1024 * 8];
        int len=-1;
        while ((len=in2.read(bytes))!=-1){
            out.write(bytes,0,len);
        }
        in1.close();
        in2.close();
        out.close();
    }
}

in.close();
out.close();
}
}
–.package org.westos.demo5;

import java.io.*;

/Author:LH
CreatTime:2020.06.05.10:54
/
//使用序列流合并三个文件
public class Test2 {
public static void main(String[] args) throws IOException {
SequenceInputStream in1 = new SequenceInputStream(new FileInputStream(“Test1.java”), new FileInputStream(“Test2.java”));
SequenceInputStream in2 = new SequenceInputStream(in1, new FileInputStream(“Test3.java”));
FileOutputStream out = new FileOutputStream(“AllTest.java”);
byte[] bytes = new byte[1024 * 8];
int len=-1;
while ((len=in2.read(bytes))!=-1){
out.write(bytes,0,len);
}
in1.close();
in2.close();
out.close();
}
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值