当前位置: 首页 > news >正文

JavaIO流

JavaIO流

  • 一、概念
  • 二、File类
  • 三、File类的使用
    • 1、File文件/文件夹类的创建
    • 2、File类的获取操作
    • 3、File类判断操作 - boolean
    • 4、File类对文件/文件夹的增删改
    • 5、File类的获取子文件夹以及子文件的方法
  • 四、Java中IO流多种维度的维度
    • 1、按照流向 - Java程序
    • 2、按照流的大小分类
    • 3、按照流的功能分类
  • 五、JavaIO流的四大基类
    • 1、InputStream
    • 2、OutputStream
    • 3、Reader
    • 4、Writer
    • 5、补充知识点——方法递归
  • 六、JavaIO流中的常用实现类
    • 1、节点流
    • 2、处理流

一、概念

Java Input/Output,一般情况指的是Java操作一些外部数据时,使用IO流的形式进行操作,外部数据主要包括文件、网络等等。

二、File类

JavaIO既可以操作文件外部数据,还可以操作网络端口这种外部数据,如果Java要操作文件外部数据,必须要借助一个类File文件对象类。

File类是Java中对文件/文件夹的抽象表示,通过这个File类,我们可以将操作系统本地的一个文件/文件夹加载到Java程序当中,随后通过File对象可以对文件进行增删改查等操作。

File类只能操作文件的外部内容、而文件当中有哪些数据,这个操作File类做不到。

三、File类的使用

1、File文件/文件夹类的创建

根据全路径创建

File file = new File("d:" + File.separator + "桌面" + File.separator + "a");

根据父子路径创建

File file = new File("d:\\桌面" ,"a");

根据父子路径创建,只不过父路径也是File对象

File file = new File(new File("d:\\桌面") ,"a");

2、File类的获取操作

//在eclipse中,因为创建的时Java项目,Java项目中所有的相对路径,指的都是项目名下的某个路径 而非Java源文件的同级路径
File file1 = new File("a/a.txt");
//获取文件名 路径最后一个文件/文件夹的名字
String fileName = file.getName();
System.out.println(fileName);
//获取文件的父路径 取决于你再构建File对象时有没有传入父路径
String parent = file.getParent();
System.out.println(parent);
//获取文件的路径 ---传入的路径
String path = file.getPath();
System.out.println(path);
//获取文件的绝对的路径--传入路径没有关系的
String absolutePath = file1.getAbsolutePath();
System.out.println(absolutePath);

3、File类判断操作 - boolean

System.out.println(file1.exists());//判断路径是否存在
System.out.println(file1.isFile());//判断是否是文件
System.out.println(file1.isDirectory());//判断是否是目录
System.out.println(file1.isHidden());//判断是否是隐藏文件System.out.println(file1.canRead());//可读
System.out.println(file1.canWrite());//可写
System.out.println(file1.canExecute());//可执行

4、File类对文件/文件夹的增删改

创建:

  • 创建文件createNewFile():要求父目录必须存在

  • 创建文件夹mkdir()创建单层目录/mkdirs()创建多层目录

删除:

  • delete()–如果是目录,目录必须空目录

修改:

  • renameTo(File):boolean
boolean mkdir = file1.mkdirs();//创建文件夹
System.out.println(mkdir);boolean creatNewFile = file1.createNewFile();//创建文件
System.out.println(creatNewFile);boolean delete = file1.delete();
System.out.println(delete);
//重命名要求两个路径必须在同一个路径下
boolean result = file1.renameTo(new File("KK"));
System.out.println(result);

5、File类的获取子文件夹以及子文件的方法

listFiles()

list():返回指定目录下的下一级的文件或者文件夹

四、Java中IO流多种维度的维度

1、按照流向 - Java程序

输入流 Input/Reader

输出流 Output/Writer

2、按照流的大小分类

字节流:Stream——什么样的数据都可以处理

字符流:Reader/Writer——只能处理纯文本类型的数据

3、按照流的功能分类

节点流:直接对接到数据源上的流
常用的节点流:文件流、数组流、网络流

处理流:无法直接对接到数据源上,而是包装了节点流,在节点流基础之上提供了更加强大的功能

五、JavaIO流的四大基类

Javaio流中所有的流都有四个顶尖父类,四个顶尖父类是四个抽象类,四个抽象类当中封装了和流有关的很多的公用方法。

1、InputStream

Java中所有字节输入流的顶尖父类 —— 一个字节一个字节的读取文件中的数据

read:int——读取的字节,全部读取完成后返回-1

available:int——可利用的字节数,还能读取的字节数

close()——关闭IO流,任何IO流都需要手动关闭

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;/**
* InputStream:是一个字节输入流
*/
public class Demo01 {public static void main(String[] args) {InputStream is = null;try {is = new FileInputStream(new File("kl/a.txt"));//读取数据源的一个字节,read每一次读取完成,下一次再进行读取,基于上一次的结果向后读取int read = is.read();System.out.println(read);//返回值,如果是read()方法,代表的是每一次读取完成的字节的值,read(byte[])的话返回值不做研究//不管什么情况下,read的返回值一旦为-1,那么代表数据与没数据了int read2 = is.read();System.out.println(read2);byte[] array = new byte[12];int read3 = is.read(array);String string = new String(array,"UTF-8");System.out.println(string);//字节流中可以利用的字节数有多少int available = is.available();System.out.println(available);} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally {if(is!=null) {try {is.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}
}

2、OutputStream

Java中所有字节输出流的顶尖父类

write:写出的字节

close()

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;/*** OutputStream基类提供的常用方法:*   write(int字节)*/
public class Demo02 {public static void main(String[] args) {OutputStream os = null;try {os = new FileOutputStream(new File("kl/a.txt"));os.write(97);//a 覆盖写os.write("中国加油".getBytes("UTF-8"));//中国加油//os.write("中国加油".getBytes("UTF-8"),0,6);//中国} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally {if(os != null) {try {os.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}
}

复制照片到指定路径

package com.nuc.kl.file.io;import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;/**
*
* @author 冰霜中的独舞
* @version 2023年7月7日 上午9:15:11
*
*/
public class FileCopy {public static void main(String[] args) {InputStream is = null;OutputStream os = null;try {is = new FileInputStream(new File("D:\\2023PracticalTraining\\software\\workspace\\eclipseworkspace\\java-study-619\\picture\\c.png"));os = new FileOutputStream(new File("D:\\2023PracticalTraining\\software\\workspace\\eclipseworkspace\\java-study-619\\picture\\d.png"));//byte[] buf = new byte[1024 * 1024];int read;while((read = is.read()) != -1) {os.write(read^5);}
//			while((read = is.read(buf)) != -1) {
//				os.write(buf);
//			}} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {if(os != null) {try {os.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}if(is != null) {try {is.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;/**
* 循环读取加密文件的1024个字节,然后对下一个字节进行解密操作^5
* 输入流(加密文件) 输出流(解密文件路径)
* 每隔1024个字节,对下一个字节进行^5运算进行加密
*/
public class Homework {public static void main(String[] args) {InputStream is =null;OutputStream os =null;try {is = new FileInputStream(new File("D:\\Desktop\\a.png"));os = new FileOutputStream(new File("D:\\Desktop\\b.png"));//循环读取is中的数据,一次读取1024个字节byte[] by = new byte[1024];while(is.read(by) != -1) {os.write(by);int r = is.read()^5;os.write(r);}System.out.println("解密完成!");} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally {if(os != null) {try {os.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}if(is != null) {try {is.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}
}

3、Reader

Java中所有字符输入流的顶尖父类

因为要根据编码集进行数据的读取,一次要读取一个字符,而一个字符对应了多个字节。编码集只有纯文本才有编码集。

  • read()
  • close()
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;/**
* Read的常用方法
* 	close()
*/
public class Demo03 {public static void main(String[] args) throws IOException {Reader r = new FileReader(new File("kl/a.txt"));int read = r.read();System.out.println(read);int read1 = r.read();System.out.println(read1);char c = (char)read1;System.out.println(c);char[] buf = new char[10];r.read(buf);System.out.println(Arrays.toString(buf));System.out.println(buf);r.close();}
}
a中国加油

image-20230708091439797

4、Writer

Java中所有字符输出流的顶尖父类

  • write
  • close —— 底层调用了flush
  • flush —— 字符流一次输出多个字节,先把多个字节缓存起来,直到遇到flush方法才会把缓存起来的结果输出
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class Demo04 {public static void main(String[] args) throws IOException {Writer w = new FileWriter(new File("kl/a.txt"));w.append('a');w.write("zs12333");w.write("ls12333");w.flush();w.close();}
}

5、补充知识点——方法递归

方法迭代其实就是一种循环,只不过这个循环比较特殊,循环我们只知道循环的终止条件,而循环的次数我们是不太清楚的

使用方法

1、将需要重复性执行的代码抽取到一个方法中

2、方法中需要对重复性执行的代码进行改造,有一个递归入口(自己调用自己的一个逻辑)、递归出口

/**
* 使用方法递归计算 ∑100
*/
public class RecursionStudy {public static void main(String[] args) {int num = 0;//for循环for (int i = 0; i <= 100; i++) {num = i + num;}System.out.println(num);//迭代System.out.println(sum(100));}public static int sum(int num) {if(num == 1) {return 1;}else {return num + sum(num-1);}}
}

六、JavaIO流中的常用实现类

1、节点流

直接连接数据源的流

  • 数组流:连接的数据源是一个数组

    • 字节数组流
      • ByteArrayInputStream——字节数组输入流
      • ByteArrayOutputStream——字节数组输出流-----输出的目的地是一个字节数组,只不过这个字节数组不需要我们创建传递,因为这个流底层封装了一个字节数组用于接收字节数据的输出
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;public class Dmeo01 {public static void main(String[] args) throws IOException, InterruptedException {ByteArrayInputStream basi =new ByteArrayInputStream("中国加油".getBytes("UTF-8"));byte[] by = new byte[12];basi.read(by);System.out.println(new String(by,"UTF-8"));ByteArrayOutputStream baos = new ByteArrayOutputStream();System.out.println(baos);baos.write("中国加油!".getBytes("UTF-8"));System.out.println(baos);String string = baos.toString("UTF-8");System.out.println(string);}
    }
    
    • 字符数组流
      • CharArrayReader——字符数组输入流
      • CharArrayWriter——字符数组输出流
  • 文件流:连接的数据源是一个文件

    • 字节流——什么文件都可以处理
      • FileInputStream
        • new FileInputStream(File)
        • new FileInputStream(String path)
        • 【注意】:文件必须存在,不存在报错
      • FileOutputStream
        • new FileOutputStream(File|String)——默认是覆盖写,因为boolean append默认为false
        • new FileOutputStream(File|String,boolean append)——追加写
        • 【注意】:文件可以不用提前存在,如果文件不存在会自动创建
    • 字符流——只能处理纯文本文件
      • FileReader
        • new FileReader(String|File)
      • FileWriter
        • new FileWriter(File|String)—默认是覆盖写
        • new FileWriter(File|String,boolean append)
        • 写出数据之后,必须flush()刷新
  • 网络流

2、处理流

处理流:对节点流进行包装,提供一些更加强大的功能——处理速度快。

  • 缓冲流:缓冲流包装另外一个流,缓冲流内部维护一个缓冲池,使用了缓冲流,一次读取多个字节、多个字符到缓冲流的内部的缓冲池当中。—— 不管是字节的还是字符的缓冲流,一定要flush。
    • 字节缓冲流 —— 缓冲了一个8192的字节数组
      • BufferedInputStream
      • BufferedOutputStream
    • 字符缓冲流
      • BufferedReader——提供了一个特殊的方法:readLine()
      • BufferedWriter——提供了一个特殊的方法:newLine()
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;public class Demo01 {public static void main(String[] args) throws Exception {BufferedReader br = new BufferedReader(new FileReader("wc.txt"));BufferedWriter bw = new BufferedWriter(new FileWriter("wc_n.txt"));String line = null;while((line = br.readLine()) != null) {line = line.toUpperCase();bw.write(line);bw.newLine();bw.flush();}bw.close();br.close();System.out.println("输出完成!");}
}
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;public class Demo01 {public static void main(String[] args) throws Exception {BufferedReader br = new BufferedReader(new FileReader("wc.txt"));BufferedWriter bw = new BufferedWriter(new FileWriter("wc_n.txt"));String line = null;while((line = br.readLine()) != null) {line = line.toUpperCase();bw.write(line);bw.newLine();bw.flush();}bw.close();br.close();System.out.println("输出完成!");}
}
  • 字节转字符流:以指定的编码集将一个字节流转换为字符流进行处理,加快我们的处理速度—纯文本类型的IO流有效

    • InputStreamReader(InputStream,charset)
    • OutputStreamWriter(OutputStream,charset)
  • 对象流——只有字节流

    • Java中的序列化(Java对象转换成二进制编码)和反序列化(Java二进制编码转换为Java对象)机制的问题

    • 序列化和反序列化需要用到Java的两个IO流

      • ObjectInputStream
      • ObjectOutputStream
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.io.FileOutputStream;
      import java.io.IOException;
      import java.io.ObjectInputStream;
      import java.io.ObjectOutputStream;public class Demo01 {public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {/*** 序列化的代码*/
      //		Student s = new Student("zs",20,"男");
      //		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student.txt"));
      //		oos.writeObject(s);
      //		oos.flush();
      //		oos.close();
      //		System.out.println("对象序列化完成!");/*** 反序列化的代码*/ObjectInputStream ois = new ObjectInputStream(new FileInputStream("student.txt"));Object object = ois.readObject();System.out.println(object);}
      }
      
    • 我们的Java对象如果想要序列化,那么必须得声明它能序列化,Java中对象默认不具备序列化的能力。如果想要具备,那么必须实现两个接口其中一个即可,序列化就是把对象的属性值转换成为二进制

      • Serializable:static或者transient修饰的属性不会序列化
      import java.io.Externalizable;
      import java.io.Serializable;
      import java.util.Objects;/**
      * JavaBean:只要私有化的属性和公开的get和set方法还有hashCode、equals、toString以及构造器
      */
      public class Student implements Serializable {private String name;private transient Integer student_age;private String student_sex;public Student() {super();}public Student(String name, Integer student_age, String student_sex) {super();this.name = name;this.student_age = student_age;this.student_sex = student_sex;}public String getName() {return name;}public void setName(String name) {this.name = name;}public Integer getStudent_age() {return student_age;}public void setStudent_age(Integer student_age) {this.student_age = student_age;}public String getStudent_sex() {return student_sex;}public void setStudent_sex(String student_sex) {this.student_sex = student_sex;}@Overridepublic int hashCode() {return Objects.hash(name, student_age, student_sex);}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Student other = (Student) obj;return Objects.equals(name, other.name) && Objects.equals(student_age, other.student_age)&& Objects.equals(student_sex, other.student_sex);}@Overridepublic String toString() {return "Student [name=" + name + ", student_age=" + student_age + ", student_sex=" + student_sex + "]";}
      }
      

      image-20230708174435258

      • Externalizable:必须重写两个方法,一个序列化写出的方法,一个反序列化读取的方法
      import java.io.Externalizable;
      import java.io.IOException;
      import java.io.ObjectInput;
      import java.io.ObjectOutput;
      import java.io.Serializable;
      import java.util.Objects;/**
      * JavaBean:只要私有化的属性和公开的get和set方法还有hashCode、equals、toString以及构造器
      */
      public class Student implements Externalizable {private static final long serialVersionUID = 1L;private String name;private transient Integer student_age;private String student_sex;public Student() {super();}public Student(String name, Integer student_age, String student_sex) {super();this.name = name;this.student_age = student_age;this.student_sex = student_sex;}public String getName() {return name;}public void setName(String name) {this.name = name;}public Integer getStudent_age() {return student_age;}public void setStudent_age(Integer student_age) {this.student_age = student_age;}public String getStudent_sex() {return student_sex;}public void setStudent_sex(String student_sex) {this.student_sex = student_sex;}@Overridepublic int hashCode() {return Objects.hash(name, student_age, student_sex);}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;Student other = (Student) obj;return Objects.equals(name, other.name) && Objects.equals(student_age, other.student_age)&& Objects.equals(student_sex, other.student_sex);}@Overridepublic String toString() {return "Student [name=" + name + ", student_age=" + student_age + ", student_sex=" + student_sex + "]";}@Overridepublic void writeExternal(ObjectOutput out) throws IOException {out.writeUTF(name);out.writeInt(student_age);}@Overridepublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {name = in.readUTF();student_age = in.readInt();}
      }
      

      image-20230708175017231

      • 序列化版本id,是为了告诉编译器,序列化的二进制和我们当前项目中的类是否为同一个版本,如果是不同的版本,那么报错。
  • 打印流——只有输出流——提供了一系列重载的print和println方法用于输出数据

    • PrintStream
    • PrintWriter
  • Java中标准输入和标准输出流

    • System.in
    • System.out
    • System.setIn(InputStream)
    • System.setOut(OutputStream)

相关文章:

JavaIO流

JavaIO流 一、概念二、File类三、File类的使用1、File文件/文件夹类的创建2、File类的获取操作3、File类判断操作 - boolean4、File类对文件/文件夹的增删改5、File类的获取子文件夹以及子文件的方法 四、Java中IO流多种维度的维度1、按照流向 - Java程序2、按照流的大小分类3、…...

FlinkSql 如何实现数据去重?

摘要 很多时候flink消费上游kafka的数据是有重复的&#xff0c;因此有时候我们想数据在落盘之前进行去重&#xff0c;这在实际开发中具有广泛的应用场景&#xff0c;此处不说详细代码&#xff0c;只粘贴相应的flinksql 代码 --********************************************…...

机器学习概念

目录 一、人工智能、机器学习、深度学习的关系 二、什么是深度学习&#xff1f; 2.1 深度学习常用算法 一、人工智能、机器学习、深度学习的关系 人工智能、机器学习和深度学习的关系如下所示。 二、什么是深度学习&#xff1f; 深度学习( DL, Deep Learning) 是机器学习 …...

【数据结构】排序(插入、选择、交换、归并) -- 详解

一、排序的概念及其运用 1、排序的概念 排序&#xff1a;所谓排序&#xff0c;就是使一串记录&#xff0c;按照其中的某个或某些关键字的大小&#xff0c;递增或递减的排列起来的操作。 稳定性&#xff1a;假定在待排序的记录序列中&#xff0c;存在多个具有相同的关键字的记…...

游戏中的图片打包流程,免费的png打包plist工具,一款把若干资源图片拼接为一张大图的免费工具

手机游戏开发中&#xff0c;为了提高图片渲染性能&#xff0c;经常需要将小图片合并成一张大图进行渲染。如果手工来做的话就非常耗时。TexturePacker就是一款非常不错方便的处理工具。TexturePacker虽然非常优秀&#xff0c;但不是免费的。 对于打包流程&#xff0c;做游戏的…...

Springboot实现ENC加密

Springboot实现ENC加密 1、导入依赖2、配置加密秘钥&#xff08;盐&#xff09;3、获取并配置密文4、重启项目测试5、自定义前缀、后缀6、自定义加密方式 1、导入依赖 关于版本&#xff0c;需要根据spring-boot版本&#xff0c;自行修改 <dependency><groupId>co…...

nginx 托管vue项目配置

server {listen 80;server_name your_domain.com;location / {root /path/to/your/vue/project;index index.html;try_files $uri $uri/ /index.html;} }奇怪的现象,在vue路由中/会跳转到/abc/def&#xff0c;但如果直接输入/abc/def会显示404&#xff0c;添加 try_files $uri…...

Vue3中如何进行封装?—组件之间的传值

用了很久一段时间Vue3Ts了&#xff0c;工作中对一些常用的组件也进行了一些封装&#xff0c;这里对封装的一些方法进行一些简单的总结。 1.props传递 首先在主组件进行定义传值 <template><div>这里是主组件<common :first"first"></common&…...

实训笔记8.25

实训笔记8.25 8.25笔记一、Flume数据采集技术1.1 Flume实现数据采集主要借助Flume的组成架构1.2 Flume采集数据的时候&#xff0c;核心是编写Flume的采集脚本xxx.conf1.2.1 脚本文件主要由五部分组成 二、Flume案例实操2.1 采集一个网络端口的数据到控制台2.1.1 分析案例的组件…...

vue自定义监听元素宽高指令

在 main.js 中添加 // 自定义监听元素高度变化指令 const resizerMap new WeakMap() const resizeObserver new ResizeObserver((entries) > {for (const entry of entries) {const handle resizerMap.get(entry.target)if (handle) {handle({width: entry.borderBoxSiz…...

网络爬虫到底是个啥?

网络爬虫到底是个啥&#xff1f; 当涉及到网络爬虫技术时&#xff0c;需要考虑多个方面&#xff0c;从网页获取到最终的数据处理和分析&#xff0c;每个阶段都有不同的算法和策略。以下是这些方面的详细解释&#xff1a; 网页获取&#xff08;Web Crawling&#xff09;&#x…...

前端行级元素和块级元素的基本区别

块级元素和行内元素的基本区别是&#xff0c; 行内元素可以与其他行内元素并排&#xff1b;块级元素独占一行&#xff0c;不能与其他任何元素并列&#xff1b; 下面看一下&#xff1b; <!DOCTYPE html> <html> <head> <meta charset"utf-8"&…...

CentOS 7用二进制安装MySQL5.7

[rootlocalhost ~]# [rootlocalhost ~]# ll 总用量 662116 -rw-------. 1 root root 1401 8月 29 19:29 anaconda-ks.cfg -rw-r--r--. 1 root root 678001736 8月 29 19:44 mysql-5.7.40-linux-glibc2.12-x86_64.tar.gz [rootlocalhost ~]# tar xf mysql-5.7.40-linux-…...

华为加速回归Mate 60发布, 7nm全自研工艺芯片

华为于今天12:08推出“HUAWEI Mate 60 Pro先锋计划”&#xff0c;让部分消费者提前体验。在华为商城看到&#xff0c;华为Mate 60 pro手机已上架&#xff0c;售价6999元&#xff0c;提供雅川青、白沙银、南糯紫、雅丹黑四种配色供选择。 据介绍&#xff0c;华为在卫星通信领域…...

Linux系列讲解 —— 【systemd】下载及编译记录

Ubuntu18.04的init程序合并到了systemd中&#xff0c;本篇文章记录一下systemd的下载和编译。 1. 下载systemd源码 (1) 查看systemd版本号&#xff0c;用来确定需要下载的分支 sunsun-pc:~$ systemd --version systemd 237 PAM AUDIT SELINUX IMA APPARMOR SMACK SYSVINIT UT…...

u-view 的u-calendar 组件设置默认日期后,多次点击后,就不滚动到默认日期的位置

场景&#xff1a;uniapp开发微信小程序 vue2 uview版本&#xff1a;2.0.36 &#xff1b; u-calendar 组件设置默认日期后 我打开弹窗&#xff0c;再关闭弹窗&#xff0c; 重复两次 就不显示默认日期了 在源码中找到这个位置进行打印值&#xff0c;根据出bug前后的值进行…...

vue naive ui 按钮绑定按键

使用vue (naive ui) 绑定Enter 按键 知识点: 按键绑定Button全局挂载使得message,notification, dialog, loadingBar 等NaiveUI 生效UMD方式使用vue 与 naive ui将vue默认的 分隔符大括号 替换 为 [[ ]] <!DOCTYPE html> <html lang"en"> <head>…...

Viobot基本功能使用及介绍

设备拿到手当然是要先试一下效果的&#xff0c;这部分可以参考本专栏的第一篇 Viobot开机指南。 接下来我们就从UI开始熟悉这个产品吧&#xff01; 1.状态 设备上电会自动运行它的程序&#xff0c;开启了一个服务器&#xff0c;上位机通过连接这个服务器连接到设备&#xff0c…...

《PMBOK指南》第七版12大原则和8大绩效域

《PMBOK指南》第七版12大原则 原则1&#xff1a;成为勤勉、尊重和关心他人的管家 原则2&#xff1a;营造协作的项目团队环境 原则3&#xff1a;有效地干系人参与 原则4&#xff1a;聚焦于价值 原则5&#xff1a;识别、评估和响应系统交互 原则6&#xff1a;展现领导力行为…...

docker 启动命令

cd /ycw/docker docker build -f DockerFile -t jshepr:1.0 . #前面测试docker已经介绍过该命令下面就不再介绍了 docker images docker run -it -p 7003:9999 --name yyy -d jshepr:1.0 #上面运行报错 用这个 不报错就不用 docker rm yyy docker ps #查看项目日志 docker …...

376. Wiggle Subsequence

376. Wiggle Subsequence 代码 class Solution { public:int wiggleMaxLength(vector<int>& nums) {int n nums.size();int res 1;int prediff 0;int curdiff 0;for(int i 0;i < n-1;i){curdiff nums[i1] - nums[i];if( (prediff > 0 && curdif…...

基于当前项目通过npm包形式暴露公共组件

1.package.sjon文件配置 其中xh-flowable就是暴露出去的npm包名 2.创建tpyes文件夹&#xff0c;并新增内容 3.创建package文件夹...

ServerTrust 并非唯一

NSURLAuthenticationMethodServerTrust 只是 authenticationMethod 的冰山一角 要理解 NSURLAuthenticationMethodServerTrust, 首先要明白它只是 authenticationMethod 的选项之一, 并非唯一 1 先厘清概念 点说明authenticationMethodURLAuthenticationChallenge.protectionS…...

css的定位(position)详解:相对定位 绝对定位 固定定位

在 CSS 中&#xff0c;元素的定位通过 position 属性控制&#xff0c;共有 5 种定位模式&#xff1a;static&#xff08;静态定位&#xff09;、relative&#xff08;相对定位&#xff09;、absolute&#xff08;绝对定位&#xff09;、fixed&#xff08;固定定位&#xff09;和…...

零基础设计模式——行为型模式 - 责任链模式

第四部分&#xff1a;行为型模式 - 责任链模式 (Chain of Responsibility Pattern) 欢迎来到行为型模式的学习&#xff01;行为型模式关注对象之间的职责分配、算法封装和对象间的交互。我们将学习的第一个行为型模式是责任链模式。 核心思想&#xff1a;使多个对象都有机会处…...

CMake 从 GitHub 下载第三方库并使用

有时我们希望直接使用 GitHub 上的开源库,而不想手动下载、编译和安装。 可以利用 CMake 提供的 FetchContent 模块来实现自动下载、构建和链接第三方库。 FetchContent 命令官方文档✅ 示例代码 我们将以 fmt 这个流行的格式化库为例,演示如何: 使用 FetchContent 从 GitH…...

自然语言处理——循环神经网络

自然语言处理——循环神经网络 循环神经网络应用到基于机器学习的自然语言处理任务序列到类别同步的序列到序列模式异步的序列到序列模式 参数学习和长程依赖问题基于门控的循环神经网络门控循环单元&#xff08;GRU&#xff09;长短期记忆神经网络&#xff08;LSTM&#xff09…...

图表类系列各种样式PPT模版分享

图标图表系列PPT模版&#xff0c;柱状图PPT模版&#xff0c;线状图PPT模版&#xff0c;折线图PPT模版&#xff0c;饼状图PPT模版&#xff0c;雷达图PPT模版&#xff0c;树状图PPT模版 图表类系列各种样式PPT模版分享&#xff1a;图表系列PPT模板https://pan.quark.cn/s/20d40aa…...

Spring AI与Spring Modulith核心技术解析

Spring AI核心架构解析 Spring AI&#xff08;https://spring.io/projects/spring-ai&#xff09;作为Spring生态中的AI集成框架&#xff0c;其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似&#xff0c;但特别为多语…...

Swagger和OpenApi的前世今生

Swagger与OpenAPI的关系演进是API标准化进程中的重要篇章&#xff0c;二者共同塑造了现代RESTful API的开发范式。 本期就扒一扒其技术演进的关键节点与核心逻辑&#xff1a; &#x1f504; 一、起源与初创期&#xff1a;Swagger的诞生&#xff08;2010-2014&#xff09; 核心…...