JAVA SE -- 第十六天

news2024/9/20 5:30:05

(全部来自“韩顺平教育”)

IO流

一、文件

是保存数据的地方

2、文件流

文件在程序中是以流的形式来操作

 流:数据在数据源(文件)和程序(内存)之间经历的路径

输入流:数据从数据源(文件)到程序(内存)的路径

输出流:数据从程序(内存)到数据源(文件)的路径

二、常用的文件操作

1、创建文件对象相关构造器和方法

 举例如下:

//方式 1 new File(String pathname)
    @Test
    public void create01() {
        String filePath = "e:\\news1.txt";
        File file = new File(filePath);
        try {
            file.createNewFile();
            System.out.println("文件创建成功");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

//方式 2 new File(File parent,String child) //根据父目录文件+子路径构建
//e:\\news2.txt
    @Test
    public void create02() {
        File parentFile = new File("e:\\");
        String fileName = "news2.txt";
        //这里的 file 对象,在 java 程序中,只是一个对象
        //只有执行了 createNewFile 方法,才会真正的,在磁盘创建该文件
        File file = new File(parentFile, fileName);
        try {
            file.createNewFile();
            System.out.println("创建成功~");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

//方式 3 new File(String parent,String child) //根据父目录+子路径构建
    @Test
    public void create03() {
        //String parentPath = "e:\\";
        String parentPath = "e:\\";
        String fileName = "news4.txt";
        File file = new File(parentPath, fileName);
        try {
            file.createNewFile();
            System.out.println("创建成功~");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

2、获取文件的相关信息

getName、getAbsolutePath、getParent、length、exists、isFile、isDirectory

    //获取文件的信息
    @Test
    public void info() {
        //先创建文件对象
        File file = new File("e:\\news1.txt");
        //调用相应的方法,得到对应信息
        System.out.println("文件名字=" + file.getName());
        //getName、getAbsolutePath、getParent、length、exists、isFile、isDirectory
        System.out.println("文件绝对路径=" + file.getAbsolutePath());
        System.out.println("文件父级目录=" + file.getParent());
        System.out.println("文件大小(字节)=" + file.length());
        System.out.println("文件是否存在=" + file.exists());//T
        System.out.println("是不是一个文件=" + file.isFile());//T
        System.out.println("是不是一个目录=" + file.isDirectory());//F
    }

 3、目录的操作和文件删除

mkdir创建一级目录、mkdirs创建多级目录、delete删除空目录或文件

三、IO流原理及流的分类

1、Java IO流原理

①I/O是Input/Output的缩写,I/O技术是非常实用的技术,用于处理数据传输。如读/写文件,网络通讯等

②Java程序中,对于数据的输入/输出操作以“流(stream)”的方式进行。

③Java.io包下提供了各种“流”类和接口,用以获取不同种类饿数据,并通过方法输入或输出数据

④输入input:读取外部数据(磁盘、光盘等存储设备的数据)到程序(内存)中

⑤输出output:将程序(内存)数据输出到磁盘、光盘等存储设备中

 2、流的分类

①按操作数据单位不同分为:字节流(8bit)二进制文件,字符流(按字符)文本文件

②按数据流的流向不同分为:输入流,输出流

③按流的角色的不同分为:节点流,处理流/包装流

(抽象基类)字节流字符流
输入流InputStreamReader
输出流OutputStreamWriter

注:Java的IO流共涉及40多个类,实际上非常规则,都是从如上4个抽象基类派生的。由这四个类派生出来的子类名称都是以其父类名作为子类名后缀。

四、IO流体系图--常用的类

 1、FileInputStream介绍

                使用 FileInputStream 读取 hello.txt 文件,并将文件内容显示到控制台

/**
* 演示读取文件...
* 单个字节的读取,效率比较低
* -> 使用 read(byte[] b)
*/
    @Test
    public void readFile01() {
        String filePath = "e:\\hello.txt";
        int readData = 0;
        FileInputStream fileInputStream = null;
        try {
            //创建 FileInputStream 对象,用于读取 文件
            fileInputStream = new FileInputStream(filePath);
            //从该输入流读取一个字节的数据。 如果没有输入可用,此方法将阻止。
            //如果返回-1 , 表示读取完毕
            while ((readData = fileInputStream.read()) != -1) {
                System.out.print((char)readData);//转成 char 显示
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //关闭文件流,释放资源.
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

/**
* 使用 read(byte[] b) 读取文件,提高效率
*/
    @Test
    public void readFile02() {
        String filePath = "e:\\hello.txt";
        //字节数组
        byte[] buf = new byte[8]; //一次读取 8 个字节.
        int readLen = 0;
        FileInputStream fileInputStream = null;
        try {
            //创建 FileInputStream 对象,用于读取 文件
            fileInputStream = new FileInputStream(filePath);
            //从该输入流读取最多 b.length 字节的数据到字节数组。 此方法将阻塞,直到某些输入可用。
            //如果返回-1 , 表示读取完毕
            //如果读取正常, 返回实际读取的字节数
            while ((readLen = fileInputStream.read(buf)) != -1) {
                System.out.print(new String(buf, 0, readLen));//显示
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //关闭文件流,释放资源.
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

2、FileOutPutStream介绍

使用 FileOutputStream 在 a.txt 文件,中写入 “hello,world”. , 如果文件不存在,会创建
文件(注意:前提是目录已经存在.)

/**
* 演示使用 FileOutputStream 将数据写到文件中,
* 如果该文件不存在,则创建该文件
*/
    @Test
    public void writeFile() {
        //创建 FileOutputStream 对象
        String filePath = "e:\\a.txt";
        FileOutputStream fileOutputStream = null;
        try {
            //得到 FileOutputStream 对象 对象
            //1. new FileOutputStream(filePath) 创建方式,当写入内容是,会覆盖原来的内容
            //2. new FileOutputStream(filePath, true) 创建方式,当写入内容是,是追加到文件后面
            fileOutputStream = new FileOutputStream(filePath, true);
            //写入一个字节
            //fileOutputStream.write('H');//
            //写入字符串
            String str = "hsp,world!";
            //str.getBytes() 可以把 字符串-> 字节数组
            //fileOutputStream.write(str.getBytes());
            /*
                write(byte[] b, int off, int len) 将 len 字节从位于偏移量 off 的指定字节数组写入此文件输出流
            */
            fileOutputStream.write(str.getBytes(), 0, 3);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

3、FileReader和FileWriter

①FileReader相关方法:

 ②FileWriter常用方法

 ③举例:

//1) 使用 FileReader 从 story.txt 读取内容,并显示
    /**
    * 单个字符读取文件
    */
    @Test
    public void readFile01() {
        String filePath = "e:\\story.txt";
        FileReader fileReader = null;
        int data = 0;
        //1. 创建 FileReader 对象
        try {
            fileReader = new FileReader(filePath);
            //循环读取 使用 read, 单个字符读取
            while ((data = fileReader.read()) != -1) {
                System.out.print((char) data);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fileReader != null) {
                    fileReader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
    * 字符数组读取文件
    */
    @Test
    public void readFile02() {
        System.out.println("~~~readFile02 ~~~");
        String filePath = "e:\\story.txt";
        FileReader fileReader = null;
        int readLen = 0;
        char[] buf = new char[8];
        //1. 创建 FileReader 对象
        try {
            fileReader = new FileReader(filePath);
            //循环读取 使用 read(buf), 返回的是实际读取到的字符数
            //如果返回-1, 说明到文件结束
            while ((readLen = fileReader.read(buf)) != -1) {
                System.out.print(new String(buf, 0, readLen));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fileReader != null) {
                    fileReader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }


//2) 使用 FileWriter 将 “风雨之后,定见彩虹” 写入到 note.txt 文件中, 注意细节.
    public class FileWriter_ {
        public static void main(String[] args) {
            String filePath = "e:\\note.txt";
            //创建 FileWriter 对象
            FileWriter fileWriter = null;
            char[] chars = {'a', 'b', 'c'};
            try {
                fileWriter = new FileWriter(filePath);//默认是覆盖写入
                // 3) write(int):写入单个字符
                fileWriter.write('H');
                // 4) write(char[]):写入指定数组
                fileWriter.write(chars);
                // 5) write(char[],off,len):写入指定数组的指定部分
                fileWriter.write("韩顺平教育".toCharArray(), 0, 3);
                // 6) write(string):写入整个字符串
                fileWriter.write(" 你好北京~");
                fileWriter.write("风雨之后,定见彩虹");
                // 7) write(string,off,len):写入字符串的指定部分
                fileWriter.write("上海天津", 0, 2);
                //在数据量大的情况下,可以使用循环操作.
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                //对应 FileWriter , 一定要关闭流,或者 flush 才能真正的把数据写入到文件
                try {
                //fileWriter.flush();
                //关闭文件流,等价 flush() + 关闭
                fileWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

五、节点流和处理流

1、基本介绍

①节点流可以从一个特定的数据源读写数据,如FileReader、FileWriter

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

 2、节点流和处理流一览图

3、节点流和处理流的区别和联系

①节点流是底层流/低级流,直接跟数据源相接

②处理流(包装流)包装节点流,既可以消除不同节点流的实现差异,也可以提供更方便的方法来完成输入输出

③处理流(也叫包装流)对节点流进行包装,使用了 修饰器设计模式,不会直接与数据源相连

 4、处理流的功能主要体现在以下两个方面:

①性能的提高:主要以增加缓冲的方式来提高输入输出的效率

②操作的便捷:处理流可能提供了一系列便捷的方法来一次输入输出大批量的数据,使用更加灵活方便

5、处理流--BufferedReader和BufferedWriter

BufferedReader和BufferedWriter属于字符流,是按照字符来读取数据的,关闭时处理流,只需要关闭外层流即可。

public class BufferedReader_ {
    public static void main(String[] args) throws Exception {
        String filePath = "e:\\a.java";
        //创建 bufferedReader
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
        //读取
        String line; //按行读取, 效率高
        //说明
        //1. bufferedReader.readLine() 是按行读取文件
        //2. 当返回 null 时,表示文件读取完毕
        while ((line = bufferedReader.readLine()) != null) {
            System.out.println(line);
        }
        //关闭流, 这里注意,只需要关闭 BufferedReader ,因为底层会自动的去关闭节点流
        //FileReader。
        bufferedReader.close();
    }
}
public class BufferedWriter_ {
    public static void main(String[] args) throws IOException {
        String filePath = "e:\\ok.txt";
        //创建 BufferedWriter
        //说明:
        //1. new FileWriter(filePath, true) 表示以追加的方式写入
        //2. new FileWriter(filePath) , 表示以覆盖的方式写入
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath));
        bufferedWriter.write("hello, 韩顺平教育!");
        bufferedWriter.newLine();//插入一个和系统相关的换行
        bufferedWriter.write("hello2, 韩顺平教育!");
        bufferedWriter.newLine();
        bufferedWriter.write("hello3, 韩顺平教育!");
        bufferedWriter.newLine();
        //说明:关闭外层流即可 , 传入的 new FileWriter(filePath) ,会在底层关闭
        bufferedWriter.close();
    }
}

6、处理流--BufferedInputStream和BufferedOutputStream

public class BufferedCopy02 {
    public static void main(String[] args) {
            
        String srcFilePath = "e:\\a.java";
        String destFilePath = "e:\\a3.java";
        //创建 BufferedOutputStream 对象 BufferedInputStream 对象
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            //因为 FileInputStream 是 InputStream 子类
            bis = new BufferedInputStream(new FileInputStream(srcFilePath));
            bos = new BufferedOutputStream(new FileOutputStream(destFilePath));
            //循环的读取文件,并写入到 destFilePath
            byte[] buff = new byte[1024];
            int readLen = 0;
            //当返回 -1 时,就表示文件读取完毕
            while ((readLen = bis.read(buff)) != -1) {
                bos.write(buff, 0, readLen);
            }
            System.out.println("文件拷贝完毕~~~");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //关闭流 , 关闭外层的处理流即可,底层会去关闭节点流
            try {
                if(bis != null) {
                    bis.close();
                }
                if(bos != null) {
                    bos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

7、对象流--ObjectInputStream和ObjectOutputStream

序列化和反序列化

①序列化就是在保存数据时,保存数据的值和数据类型

②反序列化就是在恢复数据时,恢复数据的值和数据类型

③需要让某个对象支持序列化机制,则必须让其类是可序列化的,为了让某个类是可序列化的,该类必须实现如下两个接口之一:

        Serializable  //这是一个标记接口,没有方法

        Externalizable  //该接口有方法需要实现,建议使用上面的接口

 ①对象流介绍

功能:提供了对基本类型或对象类型的序列化和反序列化的方法

ObjectOutputStream:提供序列化功能

ObjectInputStream:提供反序列化功能

②案例1:使用 ObjectOutputStream序列化基本数据类型和一个Dog对象(name,age),并保存到data.dat文件中

public class ObjectOutStream_ {
    public static void main(String[] args) throws Exception {
    //序列化后,保存的文件格式,不是存文本,而是按照他的格式来保存
    String filePath = "e:\\data.dat";
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
    //序列化数据到 e:\data.dat
    oos.writeInt(100);// int -> Integer (实现了 Serializable)
    oos.writeBoolean(true);// boolean -> Boolean (实现了 Serializable)
    oos.writeChar('a');// char -> Character (实现了 Serializable)
    oos.writeDouble(9.5);// double -> Double (实现了 Serializable)
    oos.writeUTF("韩顺平教育");//String
    //保存一个 dog 对象
    oos.writeObject(new Dog("旺财", 10, "日本", "白色"));
    oos.close();
    System.out.println("数据保存完毕(序列化形式)");
    }
}

③案例2:使用ObjectInputStream读取data.dat并反序列化恢复数据

// 1.创建流对象
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src\\data.dat"));
// 2.读取, 注意顺序
System.out.println(ois.readInt());
System.out.println(ois.readBoolean());
System.out.println(ois.readChar());
System.out.println(ois.readDouble());
System.out.println(ois.readUTF());
System.out.println(ois.readObject());
System.out.println(ois.readObject());
System.out.println(ois.readObject());
// 3.关闭
ois.close();
System.out.println("以反序列化的方式读取(恢复)ok~");

④注意事项

a.读写顺序要一致

b.要求序列化或反序列化对象,需要实现Serializable

c.序列化的类中建议添加SerialVersionUID,为了提高版本的兼容性

d.序列化对象时,默认将里面所有属性都进行序列化,但除了static或transient修饰的成员

e.序列化对象时,要求里面属性的类型也需要实现序列化接口

f.序列化具备可继承性。也就是如果某类已经实现了序列化,则它的所有子类也已经默认实现了序列化

8、标准输入输出流

类型默认设备
System.in标准输入InputStream键盘
System.out标准输出PrintStream显示器

 9、转换流--InputStreamReader和OutputStreamWriter

①基本介绍

a.InputStreamReader:Reader的子类,可以将InputStream(字节流)包装成(转换)Reader(字符流)

b.OutputStreamWriter:Writer的子类,实现将OutputStream(字节流)包装成Writer(字符流)

c.当处理纯文本数据时,如果使用字符流效率更高,并且可以有效解决中文问题,所以建议将字节流转换成字符流

d.可以在使用时指定编码格式(比如utf-8,gbk,gb2312,ISO8859-1等)

 ②例子1:将FileInputStream包装成(转换成)字符流InputStreamReader,对文件进行读取(按照utf-8/gbk格式),进而在包装成BufferedReader

public class InputStreamReader_ {
    public static void main(String[] args) throws IOException {
        String filePath = "e:\\a.txt";
        //解读
        //1. 把 FileInputStream 转成 InputStreamReader
        //2. 指定编码 gbk
        //InputStreamReader isr = new InputStreamReader(new FileInputStream(filePath), "gbk");
        //3. 把 InputStreamReader 传入 BufferedReader
        //BufferedReader br = new BufferedReader(isr);
        //将 2 和 3 合在一起
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "gbk"));
        //4. 读取
        String s = br.readLine();
        System.out.println("读取内容=" + s);
        //5. 关闭外层流
        br.close();
    }
}

③例子2:将FileOutputStream包装成(转换成)字符流OutputStreamWriter,对文件进行写入(按照gbk格式)

// 1.创建流对象
OutputStreamWriter osw =
new OutputStreamWriter(new FileOutputStream("d:\\a.txt"), "gbk");
// 2.写入
osw.write("hello,韩顺平教育~");
// 3.关闭
osw.close();
System.out.println("保存成功~");

10、打印流--PrintStream和PrintWriter

打印流只有输出流,没有输入流

六、Properties类

 

public class Properties01 {
    public static void main(String[] args) throws IOException {
        //读取 mysql.properties 文件,并得到 ip, user 和 pwd
        BufferedReader br = new BufferedReader(new FileReader("src\\mysql.properties"));
        String line = "";
        while ((line = br.readLine()) != null) { //循环读取
            String[] split = line.split("=");
            //如果我们要求指定的 ip 值
            if("ip".equals(split[0])) {
                System.out.println(split[0] + "值是: " + split[1]);
            }
        }
        br.close();
    }
}

 1、基本介绍

①专门用于读写配置文件的集合类

        配置文件的格式:

                键=值

②注意:键值对不需要有空格,值不需要用引号一起来,默认类型是String

③Properties的常见方法

2、应用案例1:使用Properties类完成对mysql.properties的读取

public class Properties02 {
    public static void main(String[] args) throws IOException {
    //使用 Properties 类来读取 mysql.properties 文件
    //1. 创建 Properties 对象
    Properties properties = new Properties();
    //2. 加载指定配置文件
    properties.load(new FileReader("src\\mysql.properties"));
    //3. 把 k-v 显示控制台
    properties.list(System.out);
    //4. 根据 key 获取对应的值
    String user = properties.getProperty("user");
    String pwd = properties.getProperty("pwd");
    System.out.println("用户名=" + user);
    System.out.println("密码是=" + pwd);
    }
}

 3、应用案例2:使用Properties类添加key-val到新文件mysql2.properties中

public class Properties03 {
    public static void main(String[] args) throws IOException {
    //使用 Properties 类来创建 配置文件, 修改配置文件内容
    Properties properties = new Properties();
    //创建
    //1.如果该文件没有 key 就是创建
    //2.如果该文件有 key ,就是修改
    properties.setProperty("charset", "utf8");
    properties.setProperty("user", "汤姆");//注意保存时,是中文的 unicode 码值
    properties.setProperty("pwd", "888888");
    //将 k-v 存储文件中即可
    properties.store(new FileOutputStream("src\\mysql2.properties"), null);
    System.out.println("保存配置文件成功~");
    }
}

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

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

相关文章

UltraToolBars Crack,动画菜单和多种显示样式

UltraToolBars Crack,动画菜单和多种显示样式 创建模仿Microsoft Office 2000外观的健壮应用程序。 UltraToolBars包括11个用于创建可自定义工具栏的界面增强控件,包括:个性化菜单、弹出型工具栏、集成选项卡控件等。PictureRegion技术使表单和组件能够采…

基于Java的新闻全文搜索引擎的设计与实现

中文摘要 本文以学术研究为目的,针对新闻行业迫切需求和全文搜索引擎技术的优越性,设计并实现了一个针对新闻领域的全文搜索引擎。该搜索引擎通过Scrapy网络爬虫工具获取新闻页面,将新闻内容存储在分布式存储系统HBase中,并利用倒…

Go 语言面试题(一):基础语法

文章目录 Q1 和 : 的区别?Q2 指针的作用?Q3 Go 允许多个返回值吗?Q4 Go 有异常类型吗?Q5 什么是协程(Goroutine)Q6 如何高效地拼接字符串Q7 什么是 rune 类型Q8 如何判断 map 中是否包含某个 key &#xf…

STM32--GPIO

文章目录 GPIO简介GPIO的基本结构GPIO位结构GPIO模式LED和蜂鸣器LED闪烁工程及程序原码代码: 蜂鸣器工程和程序原码代码 传感器光敏传感器控制蜂鸣器工程代码 GPIO简介 GPIO(General Purpose Input Output)是通用输入/输出口的简称。它是一种…

利用el-button 画圆 ,通过border-radius >50% 就成圆形

<el-button type"danger" style"border-radius: 100%; height: 100px;width: 100px;" plain><span style"font-weight: bold;">工艺分析</span></el-button>通过border-radius >50% 就成圆形。 border-radius: 50% …

STM32基础入门学习笔记:面包板 配件包扩展模块与编程

文章目录&#xff1a; 一&#xff1a;阵列键盘 1.阵列键盘测试程序 KEYPAD4x4.h KEYPAD4x4.c main.c 2.键盘中断测试程序 NVIC.h NVIC.c main.c 二&#xff1a;舵机控制 1.延时函数驱动舵机程序 SG90.h SG90.c main.c 2.PWM(脉冲宽度调制 脉宽调制/占空比)驱动…

极海APM32F003F6P6烧写问题解决记录

工作中遇到的&#xff0c;折腾了好久&#xff0c;因为电脑重装过一遍系统&#xff0c;软件也都重新安装了&#xff0c;所以不知道之前的配置是什么&#xff0c;旧项目代码编译没问题&#xff0c;烧写时疯狂报错&#xff0c;用的是JLink。 keil版本v5.14 win10版本 JLink版本…

PHP8的表达式-PHP8知识详解

表达式是 PHP 最重要的基石。在 PHP8中&#xff0c;几乎所写的任何东西都是一个表达式。简单但却最精确的定义一个表达式的方式就是"任何有值的东西"。 最基本的表达式形式是常量和变量。当键入"$a 5"&#xff0c;即将值"5"分配给变量 $a。&quo…

RocketMQ Learning

一、RocketMQ RocketMQ的产品发展 MetaQ&#xff1a;2011年&#xff0c;阿里基于Kafka的设计使用Java完全重写并推出了MetaQ 1.0版本 。 2012年&#xff0c;阿里对MetaQ的存储进行了改进&#xff0c;推出MetaQ 2.0&#xff0c;同年阿里把Meta2.0从阿里内部开源出来&am…

【Rust】Rust学习 第四章认识所有权

第四章认识所有权 所有权&#xff08;系统&#xff09;是 Rust 最为与众不同的特性&#xff0c;它让 Rust 无需垃圾回收&#xff08;garbage collector&#xff09;即可保障内存安全。因此&#xff0c;理解 Rust 中所有权如何工作是十分重要的。 4.1 所有权 所有运行的程序都…

行业报告 | 大模型助力产业,持续推进人工智能科技创新

原创 | 文 BFT机器人 随着AI应用深入千行百业&#xff0c;大模型在多个产业领域发挥着积极的作用。英伟达、META、微软等多家公司纷纷宣布AI相关行业的合作和并购机会&#xff0c;加速研发各垂类领域AI大模型&#xff0c;算力需求有望持续向上。 英伟达&#xff1a;宣布5000万…

[oeasy]python0081_[趣味拓展]ESC键进化历史_键盘演化过程_ANSI_控制序列_转义序列_CSI

光标位置 回忆上次内容 上次了解了 新的转义模式 \033 逃逸控制字符 escape 这个字符 让字符串 退出标准输出流进行控制信息的设置 可以设置 光标输出的位置 ASR33中的ALT MODE 是 今天的ESC键吗&#xff1f;&#xff1f;&#xff1f;&#xff1f;&#x1f914; 查询文档…

2023-08-06 LeetCode每日一题(24. 两两交换链表中的节点)

2023-08-06每日一题 一、题目编号 24. 两两交换链表中的节点二、题目链接 点击跳转到题目位置 三、题目描述 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff08;即&#xff0…

MySQL索引原理以及SQL优化

文章目录 一、索引1.1 索引分类1.1.1 按数据结构分类1.1.2 按物理存储分类1.1.3 按列属性分类1.1.4 按列的个数索引 1.2 索引的代价1.3 索引的使用场景1.4 不使用索引的场景 二、索引的实现原理2.1 索引存储2.2 页2.3 InnoDB中的B树2.4 InnoDB的体系结构2.5 最左匹配原则2.6 覆…

人工智能自然语言处理:抽取式文本分割(Text Segmentation)算法介绍总结,智能断句解决文本过长问题

NLP专栏简介:数据增强、智能标注、意图识别算法|多分类算法、文本信息抽取、多模态信息抽取、可解释性分析、性能调优、模型压缩算法等 专栏详细介绍:NLP专栏简介:数据增强、智能标注、意图识别算法|多分类算法、文本信息抽取、多模态信息抽取、可解释性分析、性能调优、模型…

快速修复应用程序中的问题的利器—— Android热修复

热修复技术在Android开发中扮演着重要的角色&#xff0c;它可以帮助开发者在不需要重新发布应用程序的情况下修复已经上线的应用程序中的bug或者添加新的功能。 一、热修复是什么&#xff1f; 热修复&#xff08;HotFix&#xff09;是一种在运行时修复应用程序中的问题的技术…

2023/08/05【网络课程总结】

1. 查看git拉取记录 git reflog --dateiso|grep pull2. TCP/IP和OSI七层参考模型 3. DNS域名解析 4. 预检请求OPTIONS 5. 渲染进程的回流(reflow)和重绘(repaint) 6. V8解析JavaScript 7. CDN负载均衡的简单理解 8. 重学Ajax 重学Ajax满神 9. 对于XML的理解 大白话叙述XML是…

图像 检测 - RetinaNet: Focal Loss for Dense Object Detection (arXiv 2018)

图像 检测 - RetinaNet: Focal Loss for Dense Object Detection - 密集目标检测中的焦点损失&#xff08;arXiv 2018&#xff09; 摘要1. 引言2. 相关工作References 声明&#xff1a;此翻译仅为个人学习记录 文章信息 标题&#xff1a;RetinaNet: Focal Loss for Dense Obje…

Matlab进阶绘图第25期—三维密度散点图

三维密度散点图本质上是一种特征渲染的三维散点图&#xff0c;其颜色表示某一点所在区域的密度信息。 除了作图&#xff0c;三维密度散点图绘制的关键还在于密度的计算。 当然&#xff0c;不管是作图还是密度的计算&#xff0c;这些在《Matlab论文插图绘制模板》和《Matlab点…

小研究 - 基于 MySQL 数据库的数据安全应用设计(二)

信息系统工程领域对数据安全的要求比较高&#xff0c;MySQL 数据库管理系统普遍应用于各种信息系统应用软件的开发之中&#xff0c;而角色与权限设计不仅关乎数据库中数据保密性的性能高低&#xff0c;也关系到用户使用数据库的最低要求。在对数据库的安全性进行设计时&#xf…