Java—IO 流

news2024/9/26 3:28:23

Java—IO 流

  • 🔍文件
    • 创建文件
    • 获取文件相关信息
    • 目录相关操作
  • 🔍IO 流
    • 理解流与文件
    • 流的分类
    • FileInputStream
    • FileOutputStream
    • 文件拷贝
    • FileReader
    • FileWriter
    • 节点流与处理流
      • 类型
    • BufferedReader
    • BufferedWriter
    • BufferedInputStream + BufferedOutputStream
    • 对象处理流
      • ObjectOutputStream
      • ObjectInputStream
      • 对象处理流注意事项
    • 标准输入输出流
    • 转换流
      • InputStreamReader
      • OutputStreamWriter
    • PrintStream
    • PrintWriter

🔍文件


文件, 计算机存储数据的一种方式

创建文件


下面列举了创建文件的 3 种方式, 包括

  1. File(String pathname), 指定路径名创建
  2. File(File parent, String child), 指定父抽象路径 + 子路径名创建
  3. File(String parent, String child), 指定父路径名 + 子路径名创建
public class FileCreate {

    public static void main(String[] args) {
        // create1();
        // create2();
        // create3();
    }

    // 创建方式 1, File(String pathname)
    public static void create1() {
        String pathName = "e:/test1.txt";
        File file = new File(pathName);
        try {
            boolean ret = file.createNewFile();
            if(ret) {
                System.out.println("文件创建成功");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // 创建方式 2, File(File parent, String child)
    public static void create2() {
        String parentPath = "e:/";
        File parent = new File(parentPath);
        String child = "test2.txt";
        try {
            File file = new File(parent, child);
            boolean ret = file.createNewFile();
            if(ret) {
                System.out.println("文件创建成功");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // 创建方式3, File(String parent, String child)
    public static void create3() {
        String parent = "e:/";
        String child = "test3.txt";
        try {
            File file = new File(parent, child);
            boolean ret = file.createNewFile();
            if(ret) {
                System.out.println("文件创建成功");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

获取文件相关信息


具体文章参考获取文件相关信息

  • file.getName(), 获取文件名
  • file.getAbsolutePath(), 获取文件绝对路径
  • file.getParent(), 获取文件父级目录
  • file.length(), 获取文件大小(单位: 字节)
  • file.exists(), 判断文件是否存在
  • file.isFile(), 判断是否为一个文件
  • file.isDirectory(), 判断是否为一个目录

目录相关操作


具体文章参考目录相关操作

  • file.exists(), 判断目录是否存在
  • file.delete(), 删除目录
  • file.mkdir(), 创建单级目录
  • file.mkdirs(), 创建多级目录

注意🍂

  • 执行删除目录命令时, 如果目录中存在文件, 则无法直接删除目录
  • 创建多级目录也可以应用于创建单级目录的情况

🔍IO 流


I, Input 的缩写, 表示输入
O, Output 的缩写, 表示输出

在这里插入图片描述

输入流, 数据从文件输入到程序(文件 → 程序)
输出流, 数据从程序输出到文件(程序 → 文件)

举个栗子🌰

你可以将程序看作是一个人, 将文件看作是水

在这里插入图片描述

将人喝水(水被输入到人的肚子中)的过程理解为输入流
人在喝水过程中被呛到了(水被重新洒到了杯子)的过程理解为输出流

理解流与文件


流与文件之间的关系类似于快递小哥与商品之间的关系

在这里插入图片描述

  • 将用户理解为程序
  • 将快递小哥送快递的过程理解为输入流 / 输出流
  • 将快递驿站理解为文件, 驿站中的快递(物品)理解为文件中的数据

快递小哥将快递(文件中的数据)送至用户家(程序) → 输入流
快递小哥将用户需要寄送的快递送至快递驿站 → 输出流

流负责数据的输入与输出

流的分类


  • 依据操作的对象划分为: (1) 字节流 (2) 字符流
  • 依据数据的流向划分为: (1) 输入流 (2) 输出流
抽象基类字节流字符流
输入流InputStreamReader
输出流OutputStreamWriter

在这里插入图片描述

FileInputStream


使用 FileInputStream 中的 read() 方法, 一次只能读取一个字节的内容
使用 FileInputStream 中的 read(byte[] b) 方法, 一次可以读取指定字节大小的内容

public class ReadFile {

    public static void main(String[] args) {
        // readFile1();
        // readFile2();
    }
	
	// 一次读取一个字节
    public static void readFile1() {
        String filePath = "e:/hello.txt";
        int readSize = 0;
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(filePath);
            // 从文件中一次读取一个字节的数据. 返回 -1, 表示读到文件末尾
            while((readSize = inputStream.read()) != -1) {
                System.out.print((char) readSize);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
	
	// 一次读取多个字节
    public static void readFile2() {
        String filePath = "e:/hello.txt";
        int readSize = 0;
        // 从文件中一次读取 8 个字节的数据. 返回 -1, 表示读到文件末尾
        byte[] buffer = new byte[8];
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(filePath);
            while((readSize = inputStream.read(buffer)) != -1) {
                // 注意不能写成 System.out.print(new String(buffer, 0, buffer.length));
                // 这是因为后续的 byte[] buffer 中的值由于第一次读取后的内容已经被填充
                System.out.print(new String(buffer, 0, readSize));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

FileOutputStream


使用 FileOutputStream 向指定的文件中写入内容时. 如果该文件不存在, 则会自动进行创建
使用 FileOutputStream 中的 write() 方法, 一次只能写入一个字节的内容
使用 FileOutputStream 中的 write(byte[] b) 方法, 一次可以写入指定字节大小的内容

FileOutputStream outputStream = new FileOutputStream(filePath) 再次执行程序时, 新写入的内容覆盖原有的内容
FileOutputStream outputStream = new FileOutputStream(filePath, true) 再次执行程序时, 新写入的内容会追加到原有内容的末尾

再次执行程序时, 指的是流被关闭后再次使用

public class WriteFile {

    public static void main(String[] args) {
        writeFile1();
        // writeFile2();
    }

    // 一次写入一个字节
    public static void writeFile1() {
        OutputStream outputStream = null;
        String filePath = "e:/test.txt";
        try {
            // 使用 FileOutputStream 向指定的文件中写入内容时
            // 如果该文件不存在, 则会自动进行创建
            outputStream = new FileOutputStream(filePath);
            // 当再次执行程序时, 新写入的内容覆盖原有的内容
            // outputStream = new FileOutputStream(filePath); 
            // 当再次执行程序时, 新写入的内容会追加到原有内容的末尾  
            // outputStream = new FileOutputStream(filePath, true); 
            outputStream.write('h');
            outputStream.write('e');
            outputStream.write('l');
            outputStream.write('l');
            outputStream.write('o');
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    // 一次写入多个字节
    public static void writeFile2() {
        OutputStream outputStream = null;
        String filePath = "e:/test.txt";
        try {
            // 使用 FileOutputStream 向指定的文件中写入内容时
            // 如果该文件不存在, 则会自动进行创建
            outputStream = new FileOutputStream(filePath);
            String str = "hello world";
            outputStream.write(str.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

文件拷贝


在这里插入图片描述

文件拷贝分为 2 步, 包括

  1. 读取源文件中的数据输入到程序(输入流)
  2. 从程序中输出数据到目标文件(输出流)

写入目标文件中的数据长度应该是读取到的长度, 不能是字节数组本身的长度
outputStream.write(buffer, 0, readSize)

注意🍂

拷贝文件时应每次读取部分数据时就写入目标文件, 不要一下子全部读取再写入目标文件
这是因为如果文件太大, 可能会导致执行过程崩溃

public class FileCopy {

    public static void main(String[] args) {
        copyFile();
    }

    // 文件拷贝
    // 1. 读取源文件的数据
    // 2. 将源文件的数据拷贝到目标文件路径
    public static void copyFile() {
        // srcFilePath 源文件路径(最好不要有中文)
        String srcFilePath = "D:/Csdn截图上传/Redis_01.png";
        // destFilePath 目标文件路径(最好不要有中文)
        String destFilePath = "E:/Redis2.png";
        InputStream inputStream = null;
        OutputStream outputStream = null;
        int readSize = 0;
        // 每次读取 1024 字节的数据
        byte[] buffer = new byte[1024];
        try {
            inputStream = new FileInputStream(srcFilePath);
            // 使用 FileOutputStream 向指定的文件中写入内容时
            // 如果该文件不存在, 则会自动进行创建
            outputStream = new FileOutputStream(destFilePath);
            while((readSize = inputStream.read(buffer)) != -1) {
                // 将读取到的内容写入到目标文件
                // outputStream.write(buffer);
                outputStream.write(buffer, 0, readSize);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 资源释放
            try {
                if(inputStream != null) {
                    inputStream.close();
                }
                if(outputStream != null) {
                    outputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

FileReader


使用 FileReader 中的 read() 方法, 一次只能读取一个字符的内容
使用 FileReader 中的 read(char cbuf[]) 方法, 一次可以读取指定字符大小的内容

public class ReadFile {

    public static void main(String[] args) {
        // readFile1();
        // readFile2();
    }

    // 一次读取一个字符
    public static void readFile1() {
        Reader reader = null;
        String filePath = "e:/test.txt";
        int readSize = 0;
        try {
            reader = new FileReader(filePath);
            // 从文件中一次读取一个字符的数据. 返回 -1, 表示读到文件末尾
            while((readSize = reader.read()) != -1) {
                System.out.print((char) readSize);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(reader != null) {
                    reader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    // 一次读取多个字符
    public static void readFile2() {
        Reader reader = null;
        String filePath = "e:/test.txt";
        int readSize = 0;
        char[] buffer = new char[1024];
        try {
            reader = new FileReader(filePath);
            // 从文件中一次读取多个字符的数据. 返回 -1, 表示读到文件末尾
            while((readSize = reader.read(buffer)) != -1) {
                System.out.print(new String(buffer, 0, readSize));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(reader != null) {
                    reader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

FileWriter


使用 FileWriter 向指定的文件中写入内容时. 如果该文件不存在, 则会自动进行创建
使用 FileWriter 中的 write() 方法, 一次只能写入一个字符的内容
使用 FileWriter 中的 write(char[] cbuf)write(String str) 方法, 一次可以写入指定字符大小的内容

FileWriter writer= new FileWriter(filePath) 再次执行程序时, 新写入的内容覆盖原有的内容
FileWriter writer= new FileWriter(filePath, true) 再次执行程序时, 新写入的内容会追加到原有内容的末尾

再次执行程序时, 指的是流被关闭后再次使用

FileWriter 使用之后, 必须要关闭(close)或刷新(flush). 否则数据写入不到指定的文件中

public class WriteFile {

    public static void main(String[] args) {
        // writeFile1();
        // writeFile2();
    }

    public static void writeFile1() {
        Writer writer = null;
        String filePath = "e:/note.txt";
        try {
            writer = new FileWriter(filePath);
            writer.write('我');
            writer.write('亦');
            writer.write('无');
            writer.write('他');
            writer.write(',');
            writer.write('为');
            writer.write('手');
            writer.write('属');
            writer.write('尔');
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                // 表示使用过该字符流
                if(writer != null) {
                    writer.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeFile2() {
        Writer writer = null;
        String filePath = "e:/note.txt";
        try {
            writer = new FileWriter(filePath);
            String str = "我亦无他, 为手熟尔";
            writer.write(str);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                // 表示使用过该字符流
                if(writer != null) {
                    writer.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

节点流与处理流


节点流, 针对指定的数据源读写数据. 例如 FileReader, FileWriter 针对的数据源就是文件

处理流, 也叫包装流. 是连接在已存在的流(节点流或处理流)之上, 为程序提供更为强大的读写功能. 例如 BufferedReader, BufferedWriter

翻译一下就是节点流只能做指定的工作. 而处理流不仅能做指定的工作, 还能在指定的基础之上做额外的工作

类型


分类字节输入流字节输出流字符输入流字符输出流流类型
抽象基类InputStreamOutputStreamReaderWriter
访问文件FileInputStreamFileOutputStreamFileReaderFileWriter节点流
访问数组ByteArrayInputStreamByteArrayOutputStreamCharArrayReaderCharArrayWriter节点流
访问管道PipedInputStreamPipedOutputStreamPipedReaderPipedWriter节点流
访问字符串StringReaderStringWriter节点流
缓冲流BufferedInputStreamBufferedOutputStreamBufferedReaderBufferedWriter处理流
转换流InputStreamReaderOutputStreamWriter处理流
对象流ObjectInputStreamObjectOutputStream处理流
抽象基类FilterInputStreamFilterOutputStreamFilterReaderFilterWriter处理流
打印流PrintStreamPrintWriter处理流
推回输入流PushbackInputStreamPushbackReader处理流
特殊流DataInputStreamDataOutputStream处理流

BufferedReader


public class BFReadFile {

    public static void main(String[] args) throws IOException {
        readFile();
    }

    public static void readFile() throws IOException {
        String filePath = "e:/test.txt";
        BufferedReader reader = new BufferedReader(new FileReader(filePath));;
        String line = "";
        while((line = reader.readLine()) != null) {
            System.out.println(line);
        }
        reader.close();
    }

}

BufferedWriter


public class BFWriter {

    public static void main(String[] args) throws IOException {
        writeFile();
    }

    public static void writeFile() throws IOException {
        String filePath = "e:/write.txt";
        // 表示以追加方式写入
        // BufferedWriter writer = new BufferedWriter(new FileWriter(filePath, true));
        // 表示以覆盖方式写入
        BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
        writer.write("hello world");
        // writer.write('\n');
        writer.newLine(); // 插入一个和系统相关的换行符
        writer.write("hello world");
        // writer.write('\n');
        writer.newLine(); // 插入一个和系统相关的换行符
        writer.write("hello world");
        // writer.write('\n');
        writer.newLine(); // 插入一个和系统相关的换行符
        writer.close();
    }

}

BufferedInputStream + BufferedOutputStream


利用 BufferedInputStream + BufferedOutputStream 实现文件拷贝

public class BufferedCopy {

    public static void main(String[] args) throws IOException {
        copyFile();
    }

    // 拷贝文件
    // 1. 读取源文件数据到程序(输入流)
    // 2. 将原文件数据从程序输入到目标文件(输出流)

    public static void copyFile() throws IOException {
    	// 源文件路径
        String srcFilePath = "d:/活法.pdf";
        // 目标文件路径
        String descFilePath = "e:/稻盛和夫_活法.pdf";
        BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(srcFilePath));
        BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(descFilePath));
        int readSize = 0;
        byte[] buf = new byte[1024];
        // 1. 读取源文件数据到程序
        while((readSize = inputStream.read(buf)) != -1) {
            // 2. 将原文件数据从程序输入到目标文件(输出流)
            outputStream.write(buf, 0, readSize);
            // 刷新缓冲区
            outputStream.flush();
        }
        inputStream.close();
        outputStream.close();
    }

}

对象处理流


对象处理流包括 ObjectInputStreamObjectOutputStream

通常利用 ObjectInputStreamObjectOutputStream 进行序列化与反序列化

对于序列化与反序列化的解释🍂

当我们保存数据时, 通常不会保存数据的类型

例如在 .txt 文件中保存写入 10 并保存, 此时并没有保存数据的类型. 此时我们无法确定 10 这个数据是整数还是字符串类型

在比如, 当我们保存一个浮点数 10.5 时, 虽然进行了保存, 但是无法确定这个浮点数的类型是 float 还是 double 类型

序列化的过程就是保存数据的类型 + 数据的值

反序列化的过程就是将保存数据的类型 + 数据的值

举个栗子🌰

// 示例代码
public class Student {
	private int id;
	private String name
}

定义一个学生类, 属性包括 id, name

如果只保存一个 id 的值 + name 的值. 例如 id = 10, name = “嘟嘟”. 此时我们并没有办法判断这些属性描述的具体对象. 可以是学生, 老师, 也可能是一只宠物

序列化的过程就是保存了数据的类型 + 数据的值, 也就是说将值所描述的对象一同进行保存

而反序列化的过程就是在恢复数据时, 恢复保存了的数据 + 数据的值

实现序列化的过程需要该类实现下列的任意一个接口

  • Serializable
  • Externalizable

通常选择实现 Serializable 接口, 因为这只是一个标记接口, 里面并不包含抽象方法

在这里插入图片描述

ObjectOutputStream


public class ObjOutput {

    public static void main(String[] args) throws IOException {
        writeFile();
    }

    public static void writeFile() throws IOException {
        String filePath = "e:/t1.txt";
        ObjectOutputStream outputStream = 
        	new ObjectOutputStream(new FileOutputStream(filePath));
        outputStream.writeInt(100);
        outputStream.writeChar('a');
        outputStream.writeUTF("hello world");
        outputStream.writeObject(new Student(1, "Tom"));
        outputStream.close();
        System.out.println("序列化完成");
    }

}

Student 类🍂

public class Student implements Serializable {

    private int id;
    private String name;

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

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

ObjectInputStream


public class ObjInput {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        readFile();
    }

    public static void readFile() throws IOException, ClassNotFoundException {
        String filePath = "e:/t1.txt";
        ObjectInputStream inputStream = 
        	new ObjectInputStream(new FileInputStream(filePath));
        System.out.println(inputStream.readInt());
        System.out.println(inputStream.readChar());
        System.out.println(inputStream.readUTF());
        System.out.println(inputStream.readObject());
        inputStream.close();
        System.out.println("反序列化完成");
    }
    
}

对象处理流注意事项


  1. 读写顺序需要保持一致
  2. 序列化或反序列化的对象, 需要实现 SerializableExternalizable 接口
  3. 序列化的类中建议添加 SerialVersionUID, 以便提高版本兼容性
  4. 序列化对象时, 默认将对象中的所有属性都进行序列化(被 statictransient 修饰的成员不会序列化)
  5. 序列化对象时, 要求对象中的属性也实现序列化的接口
  6. 序列化具备可继承性. 即某个类实现了序列化, 那么它的子类也默认实现了序列化

标准输入输出流


System.in 标准输入 → 默认对应设备为键盘

  • System.in 编译类型为 InputStream
  • System.in 运行类型为 PrintStream

System.out 标准输出 → 默认对应设备为显示器

  • System.out 编译类型为 PrintStream
  • System.out 运行类型为 PrintStream

转换流


转换流包括 InputStreamReaderOutputStreamReader

转换流通常用于解决乱码问题. 这是因为InputStreamReaderOutputStreamReader 的构造方法中都可以指定字符编码

在这里插入图片描述

在这里插入图片描述

InputStreamReaderReader 的子类, 可以将 InputStream(字节流) 包装为 Reader(字符流)
OutputStreamReaderWriter 的子类, 可以将 OutputStream(字节流) 包装为 Writer(字符流)

InputStreamReader


public class InputReadFile {

    public static void main(String[] args) throws IOException {
        readFile();
    }

    public static void readFile() throws IOException {
        String filePath = "e:/copyFile.pdf";
        FileInputStream inputStream = new FileInputStream(filePath);
        // 将 FileInputStream 转换为 InputStreamReader
        // 指定编码格式为 UTF-8
        InputStreamReader reader = new InputStreamReader(inputStream, "gbk");
        // 将 InputStreamReader 转换为 BufferedReader
        BufferedReader bfReader = new BufferedReader(reader);
        while(bfReader.readLine() != null) {
            System.out.println(bfReader.readLine());
        }
        bfReader.close();
    }

}

OutputStreamWriter

public class OutputWriteFile {

    public static void main(String[] args) throws IOException {
        writeFile();
    }

    public static void writeFile() throws IOException {
        String filePath = "e:/test.txt";
        FileOutputStream outputStream = new FileOutputStream(filePath);
        // 设置编码格式
        // OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
        OutputStreamWriter writer = new OutputStreamWriter(outputStream, "gbk");
        BufferedWriter bfWriter = new BufferedWriter(writer);
        bfWriter.write("hello, world");
        bfWriter.newLine();
        bfWriter.write("做到才能得到");
        bfWriter.close();
    }

}

PrintStream


public class ExPrintStream {

    public static void main(String[] args) throws IOException {
        // print1();
        // print2();
    }

    // 未设置打印位置
    // 默认将打印结果输出到显示器
    public static void print1() {
        PrintStream stream = System.out;
        stream.println("hello world");
        stream.println("做到才能得到");
        stream.close();
    }

    // 设置打印位置
    public static void print2() throws IOException {
        String filePath = "e:/test.txt";
        System.setOut(new PrintStream(filePath));
        System.out.println("输出结果到指定位置");
        System.out.close();
    }

}

PrintWriter


public class ExPrintWriter {

    public static void main(String[] args) throws IOException {
        // print1();
        print2();
    }

    // 为指定输出位置
    // 默认将打印结果输出到显示器
    public static void print1() {
        PrintWriter writer = new PrintWriter(System.out);
        writer.println("hello world");
        writer.println("hello myFriend");
        writer.close();
    }

    // 指定输出位置
    public static void print2() throws IOException {
        String filePath = "e:/test.txt";
        PrintWriter writer = new PrintWriter(new FileWriter(filePath));
        writer.println("hello world");
        writer.println("hello myFriend");
        writer.close();
    }

}

🌸🌸🌸完结撒花🌸🌸🌸

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/853942.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

erp与crm的区别有哪些呢?两者之间有什么联系?

阅读本文您可以了解:1、crm系统的功能;2、erp系统的功能;3、crm系统和erp系统的区别 一、crm系统是什么 CRM系统是客户关系管理系统的缩写。它是一种用于帮助企业有效管理与客户关系相关的信息、活动和数据的软件工具或平台。 举个例子&…

在服务器上搭建gitlab

目录 1.在服务器上下载gitlab 2.编辑站点位置 3.重载配置 4.访问gitlab 最终效果展示: 官方文档: 安装部署GitLab服务 1.在服务器上下载gitlab wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.9.0-ce.0.el7.x86_64.r…

lombok 因 idea版本过高不可用

报错: 解决: 添加配置: -Djps.track.ap.dependenciesfalse

信创环境下 FTP如何进行国产化替代?

一、政策驱动,倡导自主、创新、协同 信创,即信息技术应用创新产业,其是数据安全、网络安全的基础,也是新基建的重要组成部分。为打破国外巨头的垄断,解决核心技术关键环节“卡脖子”问题,在核心芯片、基础…

电子保险丝

TPS2660 具有集成输入反极性保护功能的 4.2V 至 60V、150mΩ、0.1A 至 2.23A 电子保险丝 电流监测,故障输出,反向电流始终阻断,反极性保护 29元 TPS2640 具有集成反向输入极性保护功能的 42V、2A 工业电子保险丝 17元 MAX17561AUD 40V&…

robotframework+selenium 进行webui页面自动化测试

robotframework其实就是一个自动化的框架,想要进行什么样的自动化测试,就需要在这框架上添加相应的库文件,而用于webui页面自动化测试的就是selenium库. 关于robotframework框架的搭建我这里就不说了,今天就给大家根据一个登录的实…

【RocketMQ入门-安装部署与Java API测试】

【RocketMQ入门-安装部署与Java API测试】 一、环境说明二、安装部署三、Java API 编写Producer和Consumer进行测试四、小结 一、环境说明 虚拟机VWMare:安装centos7.6操作系统源码包:rocketmq-all-5.1.3-source-release.zip单master部署,在…

【论文研读】MARLlib 的架构分析

【论文研读】MARLlib: A Scalable Multi-agent Reinforcement Learning Library 和尚念经 多智能体强化学习框架研究。 多智能体强化学习库。 多智能体强化学习算法实现。 多智能体强化学习环境的统一化,标准化。 多智能体强化学习算法解析。 多智能体强化学习 算法…

Kafka:springboot集成kafka收发消息

kafka环境搭建参考Kafka&#xff1a;安装和配置_moreCalm的博客-CSDN博客 1、springboot中引入kafka依赖 <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><…

如何用Postman做接口自动化测试,你知道么?

什么是自动化测试&#xff1f; 把人对软件的测试行为转化为由机器执行测试行为的一种实践。 例如GUI自动化测试&#xff0c;模拟人去操作软件界面&#xff0c;把人从简单重复的劳动中解放出来。 本质是用代码去测试另一段代码&#xff0c;属于一种软件开发工作&#xff0c;已…

数据结构入门:栈

目录 前言 1. 栈 1.1栈的概念及结构 1.2 栈的实现 1.2.1 栈的定义 1.2.2 栈的初始化 1.2.3 入栈 1.2.4 出栈 1.2.5 栈的元素个数 1.2.6 栈顶数据 1.2.7 栈的判空 2.栈的应用 2.1 题目一&#xff1a;括号匹配 2.1.1 思路 2.1.2 分析 2.1.3 题解 总结 前言 无论你是计算机科学专…

初学者自学python哪本书好,python教程自学全套

大家好&#xff0c;小编来为大家解答以下问题&#xff0c;python怎么自学,可以达到什么程度&#xff0c;初学者自学python哪本书好&#xff0c;现在让我们一起来看看吧&#xff01; 前言 Python是一个非常适合自学&#xff0c;0基础的话从入门到精通也只需要花3-4个月PYTHON库“…

诚迈科技亮相华为开发者大会2023,打造万物互联全场景生态

8月4-6日&#xff0c;华为开发者大会2023在中国松山湖盛大举行&#xff0c;诚迈科技作为华为合作伙伴携一系列基于OpenHarmony和HarmonyOS Connect的创新技术及生态成果&#xff0c;精彩亮相OpenHarmony共建展区、OpenHarmony使能展区和鸿蒙智联展区&#xff0c;吸引了众多行业…

nginx负载均衡(nginx结束)

本节主要内容 1、四层&#xff0c;七层代理的配置方法 2、负载均衡的算法 nginx负载均衡&#xff1a;反向代理来实现 反向代理有两种转发方式&#xff1a;1、四层代理 2、七层代理 Nginx的七层代理和四层代理 七层是最常见的反向代理方式&#xff0c;只能配置在nginx配置文…

基于SDK方式的小程序监控

基于SDK方式的小程序监控 一、背景 微信小程序自 2017 年正式上线以来&#xff0c;就受到商家和开发者的青睐。到 2022 年底&#xff0c;我国的互联网普及率已经高达 75.6%。随着互联网的快速发展&#xff0c;小程序也在快速成长&#xff0c;不仅使用人数在逐年攀升&#xff…

宝尊电商短期前景堪忧,宝尊国际能否取得成功还有待验证

来源&#xff1a;猛兽财经 作者&#xff1a;猛兽财经 核心业务面临短期逆风 在2023年第一季度财报中&#xff0c;宝尊电商&#xff08;BZUN&#xff09;表示其电商业务(简称BEC)主要包括&#xff1a;品牌的门店运营、客户服务以及物流和供应链管理、IT和数字营销等增值服务”。…

词嵌入、情感分类任务

目录 1.词嵌入&#xff08;word embedding&#xff09; 对单词使用one-hot编码的缺点是难以看出词与词之间的关系。 所以需要使用更加特征化的表示&#xff08;featurized representation&#xff09;&#xff0c;如下图所示&#xff0c;我们可以得到每个词的向量表达。 假设…

php webshell 免杀入门

webshell 查杀软件&#xff1a; d盾、安全狗、护卫神、Sangfor WebShellKill 在线查杀 百度WEBDIR https://scanner.baidu.com 河马 https://www.shellpub.com cloudwalker牧云 https://webshellchop.chaitin.cn 查杀技术 静态检测、动态检测、日志检查 静态检查&#xff1a…

感觉和身边其他人有差距?你的感觉我懂!

在我们的成长历程中&#xff0c;总要经历不同的人和事&#xff0c;身边不乏比我们优秀&#xff0c;比我们厉害的人&#xff0c;这个是无可避免的&#xff0c;也是无法选择的&#xff0c;但是可以选择的是&#xff1a;我们怎么做&#xff01; 目录 我的情况事件感受 我的解法心态…

【人工智能前沿弄潮】—— 玩转SAM(Segment Anything)

玩转SAM(Segment Anything) 官网链接&#xff1a; Segment Anything | Meta AI (segment-anything.com) github链接&#xff1a; facebookresearch/segment-anything: The repository provides code for running inference with the SegmentAnything Model (SAM), links fo…