Java技术复习提升 15IO流
先给各位读者致歉 笔者因身体抱恙 未能及时更新 以后会按时更新 和大家一起学习探究~
第15章 IO流
15.1 文件
文件就是保存数据的地方
文件流
15.2 常用文件操作
创建文件对象构造器和方法
import org.junit.Test;import java.io.File; import java.io.IOException;public class CreateFile {public static void main(String[] args) {CreateFile file=new CreateFile();file.method1();file.method2();file.method3();}@Test//file(String path)public void method1(){String filePath="D:\\JavaProject\\test1129\\news1.txt";File file=new File(filePath);try {file.createNewFile();System.out.println("method1 success");} catch (IOException e) {e.printStackTrace();}}@Test//file(File parentFilePath,String filePath)public void method2(){String parentFilePath="D:\\JavaProject\\test1129\\";File parentFile=new File(parentFilePath);String filePath="news2.txt";File file=new File(parentFile,filePath);try {file.createNewFile();System.out.println("method2 success");} catch (IOException e) {e.printStackTrace();}}@Test//file(String parentFilePath,String filePath)public void method3(){String parentfilePath="D:\\JavaProject\\test1129\\";String filePath="news3.txt";File file=new File(parentfilePath,filePath);try {file.createNewFile();System.out.println("method3 success");} catch (IOException e) {e.printStackTrace();}} }
获取文件相关信息
import org.junit.Test;import java.io.File; public class FileInformation {public static void main(String[] args) {FileInformation file=new FileInformation();file.info();}//获取文件的信息@Testpublic void info() {//先创建文件对象File file = new File("e:\\news1.txt");//注意,这里没有用createNewFile方法,因为这并不是在创建文件,而是创建这个已经存在的文件的一个对象,来对这个文件进行一些操作//调用相应的方法,得到对应信息System.out.println("文件名字=" + file.getName());//getName、getAbsolutePath、getParent、length、exists、isFile、isDirectorySystem.out.println("文件绝对路径=" + file.getAbsolutePath());System.out.println("文件父级目录=" + file.getParent());System.out.println("文件大小(字节)=" + file.length());System.out.println("文件是否存在=" + file.exists());//TSystem.out.println("是不是一个文件=" + file.isFile());//TSystem.out.println("是不是一个目录=" + file.isDirectory());//F} }
目录的操作和文件删除
import org.junit.jupiter.api.Test;import java.io.File; import java.io.InputStream; import java.io.OutputStream; public class Directory_ {public static void main(String[] args) {}//判断 d:\\news1.txt 是否存在,如果存在就删除@Testpublic void m1() {String filePath = "e:\\news1.txt";File file = new File(filePath);if (file.exists()) {if (file.delete()) {System.out.println(filePath + "删除成功");} else {System.out.println(filePath + "删除失败");}} else {System.out.println("该文件不存在...");}}//判断 D:\\demo02 是否存在,存在就删除,否则提示不存在//这里我们需要体会到,在java编程中,目录也被当做文件@Testpublic void m2() {String filePath = "D:\\demo02";File file = new File(filePath);if (file.exists()) {if (file.delete()) {System.out.println(filePath + "删除成功");} else {System.out.println(filePath + "删除失败");}} else {System.out.println("该目录不存在...");}}//判断 D:\\demo\\a\\b\\c 目录是否存在,如果存在就提示已经存在,否则就创建@Testpublic void m3() {String directoryPath = "D:\\demo\\a\\b\\c";File file = new File(directoryPath);if (file.exists()) {System.out.println(directoryPath + "存在..");} else {if (file.mkdirs()) { //创建一级目录使用mkdir() ,创建多级目录使用mkdirs()System.out.println(directoryPath + "创建成功..");} else {System.out.println(directoryPath + "创建失败...");}}} }
15.3 IO流原理 流的分类
15.4 IO流体系图 常用类
InputStream
import org.junit.jupiter.api.Test; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; /*** 演示FileInputStream的使用(字节输入流 文件--> 程序)*/ public class FileInputStream_ {public static void main(String[] args) {}/*** 演示读取文件...* 单个字节的读取,效率比较低* -> 使用 read(byte[] b)*/@Testpublic void readFile01() {String filePath = "D:\\JavaProject\\test1129\\news1.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) 读取文件,提高效率*/@Testpublic void readFile02() {String filePath = "D:\\JavaProject\\test1129\\news1.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();}}} }
FileOutputStream
import org.junit.jupiter.api.Test; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class FileOutputStream01 {public static void main(String[] args) {}/*** 演示使用FileOutputStream 将数据写到文件中,* 如果该文件不存在,则创建该文件*/@Testpublic void writeFile() {//创建 FileOutputStream对象String filePath = "D:\\JavaProject\\test1129\\news2.txt";FileOutputStream fileOutputStream = null;try {//得到 FileOutputStream对象 对象//说明//1. new FileOutputStream(filePath) 创建方式,当写入内容时,会覆盖原来的内容//2. new FileOutputStream(filePath, true) 创建方式,当写入内容时,是追加到文件后面//不带 append 时:1.不论创建文件字节输出流前磁盘上是否有该文件,最终都会通过当前字节文件输出流在磁盘上创建文件 2.覆盖的不是内容,而是直接替换文件。简而言之,如果不带 append 就是在磁盘上面新创建一个文件(不论是否已存在)然后打开操作,覆盖是发生在文件层面,而不是文件里面的内容;如果 true 就是打开磁盘上已有的文件在其内容末尾进行操作fileOutputStream = new FileOutputStream(filePath, true);//写入一个字节//fileOutputStream.write('H');////写入字符串String str = "byx,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();}}} }
import java.io.*; public class FileCopy {public static void main(String[] args) {//完成 文件拷贝,将 e:\\Koala.jpg 拷贝 c:\\//思路分析//1. 创建文件的输入流 , 将文件读入到程序//2. 创建文件的输出流, 将读取到的文件数据,写入到指定的文件.String srcFilePath = "D:\\JavaProject\\test1129\\news1.txt";String destFilePath = "D:\\JavaProject\\test1129\\news2.txt";FileInputStream fileInputStream = null;FileOutputStream fileOutputStream = null;try {fileInputStream = new FileInputStream(srcFilePath);fileOutputStream = new FileOutputStream(destFilePath);//定义一个字节数组,提高读取效果byte[] buf = new byte[1024];int readLen = 0;while ((readLen = fileInputStream.read(buf)) != -1) {//读取到后,就写入到文件 通过 fileOutputStream//即,是一边读,一边写fileOutputStream.write(buf, 0, readLen);//一定要使用这个方法//这里写入并不会覆盖,因为没有关闭输出流}System.out.println("拷贝ok~");} catch (IOException e) {e.printStackTrace();} finally {try {//关闭输入流和输出流,释放资源if (fileInputStream != null) {fileInputStream.close();}if (fileOutputStream != null) {fileOutputStream.close();}} catch (IOException e) {e.printStackTrace();}}} }
FileReader
import org.junit.jupiter.api.Test; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class FileReader_ {public static void main(String[] args) {}/*** 单个字符读取文件*/@Testpublic void readFile01() {String filePath = "D:\\JavaProject\\test1129\\news1.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();}}}/*** 字符数组读取文件*/@Testpublic void readFile02() {System.out.println("~~~readFile02 ~~~");String filePath = "D:\\JavaProject\\test1129\\news1.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();}}} }
FileWriter
import java.io.FileWriter; import java.io.IOException; public class FileWriter_ {public static void main(String[] args) {String filePath = "D:\\JavaProject\\test1129\\new1.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("byx".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才能真正的把数据写入到文件//老韩看源码就知道原因./*看看源码private void writeBytes() throws IOException {this.bb.flip();int var1 = this.bb.limit();int var2 = this.bb.position();assert var2 <= var1;int var3 = var2 <= var1 ? var1 - var2 : 0;if (var3 > 0) {if (this.ch != null) {assert this.ch.write(this.bb) == var3 : var3;} else {this.out.write(this.bb.array(), this.bb.arrayOffset() + var2, var3);}}this.bb.clear();}*/try {//fileWriter.flush();//关闭文件流,等价 flush() + 关闭fileWriter.close();} catch (IOException e) {e.printStackTrace();}}System.out.println("程序结束...");} }
15.5 节点流和处理流
节点流和处理流的区别和联系
BufferedReader
import java.io.FileNotFoundException; import java.io.FileReader; import java.io.BufferedReader; import java.io.IOException;class BufferedReader_{public static void main(String[] args) throws IOException {String filePath="D:\\JavaProject\\test1129\\news1.txt";BufferedReader br=new BufferedReader(new FileReader(filePath));String line;while((line= br.readLine())!=null){System.out.println(line);}br.close();} }
BufferedWriter
import java.io.*;class BufferedReader_{public static void main(String[] args) throws IOException {String filePath="D:\\JavaProject\\test1129\\news1.txt";//创建BufferedWriter//说明://1. new FileWriter(filePath, true) 表示以追加的方式写入//2. new FileWriter(filePath) , 表示以覆盖的方式写入BufferedWriter br=new BufferedWriter(new FileWriter(filePath));br.write("hello,byx!");br.newLine();//插入一个当前系统(windows、Linux等)对应的换行符br.write("hello2, byx!");br.newLine();br.write("hello3, byx!");br.newLine();br.close();} }
import java.io.*;class BufferedReader_{public static void main(String[] args) throws IOException {String br_filePath="D:\\JavaProject\\test1129\\news1.txt";String bw_filePath="D:\\JavaProject\\test1129\\news2.txt";//创建BufferedWriter//说明://1. new FileWriter(filePath, true) 表示以追加的方式写入//2. new FileWriter(filePath) , 表示以覆盖的方式写入BufferedReader br=null;BufferedWriter bw=null;String line=null;try{bw=new BufferedWriter(new FileWriter(bw_filePath));br=new BufferedReader(new FileReader(br_filePath));while((line=br.readLine())!=null){bw.write(line);bw.newLine();}}catch(IOException e){e.printStackTrace();}finally{//关闭流try{if(br!=null){br.close();}if(bw!=null){bw.close();}}catch(IOException e){e.printStackTrace();}}} }
BufferedInputStream
BufferedOutputStream
import java.io.*; /*** 演示使用BufferedOutputStream 和 BufferedInputStream使用* 使用他们,可以完成二进制文件拷贝.* 思考:字节流可以操作二进制文件,可以操作文本文件吗?当然可以*/ public class BufferedCopy02 {public static void main(String[] args) { // String srcFilePath = "e:\\Koala.jpg"; // String destFilePath = "e:\\hsp.jpg"; // String srcFilePath = "e:\\0245_韩顺平零基础学Java_引出this.avi"; // String destFilePath = "e:\\hsp.avi";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));//循环的读取文件,并写入到 destFilePathbyte[] 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();}}} }
对象流
package com.hspedu.outputstream_;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* 演示ObjectOutputStream的使用, 完成数据的序列化
*/
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("数据保存完毕(序列化形式)");
}
}
package com.hspedu.inputstream_;
import com.hspedu.outputstream_.Dog;
import java.io.*;
public class ObjectInputStream_ {
public static void main(String[] args) throws IOException, ClassNotFoundException {
//指定反序列化的文件
String filePath = "e:\\data.dat";
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath));
//读取
//老师解读
//1. 读取(反序列化)的顺序需要和你保存数据(序列化)的顺序一致
//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());
//dog 的编译类型是 Object , dog 的运行类型是 Dog
Object dog = ois.readObject();
System.out.println("运行类型=" + dog.getClass());
System.out.println("dog信息=" + dog);//底层 Object -> Dog//这里是特别重要的细节:
//1. 如果我们希望调用Dog的方法, 需要向下转型
//2. 需要我们将Dog类的定义放在可以引用的位置
Dog dog2 = (Dog)dog;
System.out.println(dog2.getName()); //旺财..
//关闭流, 关闭外层流即可,底层会关闭 FileInputStream 流
ois.close();
}
}
package com.hspedu.outputstream_;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* 演示ObjectOutputStream的使用, 完成数据的序列化
*/
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("数据保存完毕(序列化形式)");
}
}
标准输入输出流
转换流-InputStreamReader/OutputStreamWriter
a.txt默认是UTF-8编码,但如果改成其它编码(例如:ANSI(国标码,在中国windows系统下一般是GBK))后,运行程序输出的数据就会乱码
打印流 printstream/printwriter
package com.fsl;import java.io.IOException; import java.io.PrintStream; /*** 演示PrintStream (字节打印流/输出流)*/ public class PrintStream_ {public static void main(String[] args) throws IOException {PrintStream out = System.out;//在默认情况下,PrintStream 输出数据的位置是 标准输出,即显示器/*public void print(String s) {if (s == null) {s = "null";}write(s);}*/out.print("john, hello");//因为print底层使用的是write , 所以我们可以直接调用write进行打印/输出,本质是一样的out.write("你好".getBytes());out.close();//我们可以去修改打印流输出的位置/设备//1. 输出修改成到 "e:\\f1.txt"//2. "hello, 韩顺平教育~" 就会输出到 e:\f1.txt//3. public static void setOut(PrintStream out) {// checkIO();// setOut0(out); // native 方法,修改了out// }System.setOut(new PrintStream("e:\\f1.txt"));System.out.println("hello, 教育~");} }
package com.hspedu.transformation; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; /*** 演示 PrintWriter 使用方式*/ public class PrintWriter_ {public static void main(String[] args) throws IOException {//PrintWriter printWriter = new PrintWriter(System.out);PrintWriter printWriter = new PrintWriter(new FileWriter("e:\\f2.txt"));printWriter.print("hi, 北京你好~~~~");printWriter.close();//flush + 关闭流, 才会将数据写入到文件..} }
15.6 Properties类 加载配置文件
相关文章:
Java技术复习提升 15IO流
先给各位读者致歉 笔者因身体抱恙 未能及时更新 以后会按时更新 和大家一起学习探究~ 第15章 IO流 15.1 文件 文件就是保存数据的地方 文件流 15.2 常用文件操作 创建文件对象构造器和方法 import org.junit.Test;import java.io.File; import java.io.IOException;publ…...
Oracle 19C Data Guard 单实例1+1部署(Duplicate方式)
环境描述 项目主库备库操作系统CentOS 7.9CentOS 7.9数据库版本Oracle 19.3.0.0Oracle 19.3.0.0ORACLE_UNQNAMEhishisdgIP地址10.172.1.10110.172.1.102Hostnamehisdb01hisdb02SIDhishisdb_namehishisdb_unique_namehishisdg 说明 主库和备库建议采用相同服务器配置。主库和…...
网安小白的端口关闭实践
proceeding 扫描 $ nmap --top-ports 10000 10.162.8.227 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-29 17:07 CST Nmap scan report for star (10.162.8.227) Host is up (0.00023s latency). Not shown: 8367 closed tcp ports (conn-refused) PORT ST…...
微软要求 Windows Insider 用户试用备受争议的召回功能
拥有搭载 Qualcomm Snapdragon 处理器的 Copilot PC 的 Windows Insider 计划参与者现在可以试用 Recall,这是一项臭名昭著的快照拍摄 AI 功能,在今年早些时候推出时受到了很多批评。 Windows 营销高级总监 Melissa Grant 上周表示:“我们听…...
nginx反向代理、负载均衡
nginx反向代理、负载均衡 一、反向代理 proxy模块1、作用2、语法3、配置后端服务器记录真实的客户端地址 二、负载均衡 upstream模块2.1 负载均衡作用2.2 调度算法/策略2.3 配置语法 一、反向代理 proxy模块 1、作用 提升业务的性能、并发能力 隐藏后端真实业务服务器的信息&…...
mysql集群NDB方式部署
1. 基本信息 部署机器角色部署路径192.168.0.1管理节点部署目录: /alidata1/mysql-cluster-8.4.3192.168.0.2管理节点192.168.0.3数据/SQL节点数据目录:192.168.0.4数据/SQL节点/alidata1/mysql-cluster-8.4.3/data/ndb-mgmd192.168.0.5数据节点 – 新增/alidata1/mysql-clust…...
Fabric.js 中文文档
Fabric.js 中文文档 基于canvas画布的实用类Fabric.js的使用 4、Fabric.js 常用的方法&事件 Fabric.js 画布 defaultCursor 属性(1) 官网文档地址:http://fabricjs.com/docs/github 地址:https://github.com/fabricjs/fabric.js Demo地址&#x…...
【面试重难点问题】c++中为什么可以函数重载,但是c语言中不可以
本文章是对于“c中为什么可以函数重载,但是c语言中不可以”这个问题的探究: 当然这是一个值得深入探讨的问题。在面对难题时,我们常常会竭尽全力寻找答案,不惜挖掘三尺以探究竟。面对上面这个问题时,理解计算机系统的…...
Elasticsearch优化汇总
文章目录 引言硬件设置优化禁用swap给系统留足够的内存JVM配置使用更快的硬件,使用 SSD 参数优化分片设计增加Buffer大小(增加吞吐量)预热文件系统 cache es查询设计优化预索引数据使用filter代替query字段映射避免使用脚本优化日期搜索为只读索引执行 force-merge预热全局序号…...
【落羽的落羽 C语言篇】指针·之其四
文章目录 一、字符指针变量二、数组指针变量1. 创建2. 数组指针类型3. 二维数组传参的本质 三、函数指针变量1. 创建2. 函数指针类型3. 函数指针的使用4. 分析两句“有趣”的代码(doge)5. typedef关键字 四、函数指针数组1. 创建2. 函数指针数组的用途—…...
十二、正则表达式、元字符、替换修饰符、手势和对话框插件、字符串截取
1. 正则表达式 1.1 基本使用 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title&g…...
嵌入式的应用领域有哪些
首先给大家介绍一下,STM32是意法半导体(STMicroelectronics)生产的32位微控制器(MCU)系列,采用ARM Cortex-M内核设计,以其高性能、低功耗和广泛的应用而闻名。 那么意法半导体是在…...
git merge :开发分支与主分支的交互
一、开发分支(dev)上的代码达到上线的标准后,要合并到 master 分支 git checkout dev git pull git checkout master git merge dev git push -u origin master 二、当master代码改动了,需要更新开发分支(dev&#x…...
OGRE 3D----4. OGRE和QML共享opengl上下文
在现代图形应用开发中,OGRE(Object-Oriented Graphics Rendering Engine)和QML(Qt Modeling Language)都是非常流行的工具。OGRE提供了强大的3D渲染能力,而QML则用于构建灵活的用户界面。在某些应用场景中,我们需要在同一个应用程序中同时使用OGRE和QML,并且共享OpenGL…...
ArcGIS 软件中路网数据的制作
内容导读 路网数据是进行网络分析的基础,它是建立网络数据集的数据来源。 本文我们以OSM路网数据为例,详细介绍OSM路网数据从下载,到数据处理,添加属性,完成符合网络分析的网络数据集的全部过程。 01 数据获取 比较…...
Milvus 2.5:全文检索上线,标量过滤提速,易用性再突破!
01. 概览 我们很高兴为大家带来 Milvus 2.5 最新版本的介绍。 在 Milvus 2.5 里,最重要的一个更新是我们带来了“全新”的全文检索能力,之所以说“全新”主要是基于以下两点: 第一,对于全文检索基于的 BM25 算法,我们采…...
Windows常用DOS指令(附案例)
文章目录 1.dir 查看当前目录2.cd 进入指定目录3.md 创建指定目录4.cd> 创建指定文件5.rd 删除指定空目录6.del 删除指定文件7.copy 复制文件8.xcopy 批量复制9.ren 改名10.type 在命令行空窗口打开文件11.cls 清空DOS命令窗口12.chkdsk 检查磁盘使用情况13.time 显示和设置…...
搜索二维矩阵 II(java)
题目描述 编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target 。该矩阵具有以下特性: 每行的元素从左到右升序排列。每列的元素从上到下升序排列。 代码思路: 用暴力算法: class Solution {public boolean searchMatrix(…...
Webpack 的构建流程
Webpack 的构建流程可以概括为以下几个步骤: 1. 初始化: Webpack 读取配置文件(webpack.config.js),合并默认配置和命令行参数,初始化Compiler对象。 2. 构建依赖图: 从入口文件开始递归地分…...
Kylin Server V10 下 RocketMQ 主备自动切换模式部署
一、NameServer简介 NameServer 是一个注册中心,提供服务注册和服务发现的功能。NameServer 可以集群部署,集群中每个节点都是对等的关系,节点之间互不通信。 服务注册 Broker 启动的时候会向所有的 NameServer 节点进行注册,注意这里是向集群中所有的 NameServer 节点注册…...
Linux启动中出现“psi: inconsistent task state!”错误可能原因
在Linux系统中,psi: inconsistent task state! 异常日志通常与 PSI(Pressure Stall Information)相关。PSI 是 Linux 内核中的一个特性,用于监控系统资源的压力情况,如 CPU、内存和 I/O 等。该日志信息表明在处理任务状…...
FCBP 认证考试要点摘要
理论知识 数据处理与分析:包括数据的收集、清洗、转换、存储等基础操作,以及数据分析方法,如描述性统计分析、相关性分析、数据挖掘算法等的理解和应用 。数据可视化:涉及图表类型的选择与应用,如柱状图、折线图、饼图…...
ubuntu防火墙入门(一)——设置服务、关闭端口
本机想通过git clone gitgithub.com:skumra/robotic-grasping.git下载代码,firewall-config中需要为当前区域的防火墙开启SSH服务吗 是的,如果你想通过 git clone gitgithub.com:skumra/robotic-grasping.git 使用 SSH 协议从 GitHub 下载代码࿰…...
yt6801 ubuntu有线连接驱动安装
耀世16pro的有线网卡驱动安装 下载地址: YT6801 千兆PCIE以太网控制器芯片 1. 创建安装目录 mkdir yt68012. 解压驱动文件 unzip yt6801-linux-driver-1.0.27.zip -d yt68013. 进入驱动目录 cd yt68014. 安装驱动 以 root 权限运行安装脚本: sudo su ./yt_ni…...
ASP.NET Core Web API 控制器
文章目录 一、基类:ControllerBase二、API 控制器类属性三、使用 Get() 方法提供天气预报结果 在深入探讨如何编写自己的 PizzaController 类之前,让我们先看一下 WeatherController 示例中的代码,了解它的工作原理。 在本单元中,…...
【论文笔记】Tool Learning with Foundation Models 论文笔记
Tool Learning with Foundation Models 论文笔记 文章目录 Tool Learning with Foundation Models 论文笔记摘要背景:工作: 引言工具学习的发展本文工作(大纲&目录) 背景2.1 工具使用的认知起源2.2 工具分类:用户界…...
STM32 + CubeMX + 串口 + IAP升级
这篇文章分享一个简单的串口IAP Demo,实现使用串口更新我们自己的App程序。 目录 一、IAP简介二、Stm32CubeMx配置三、Boot代码及配置1、代码2、配置 四、App代码及配置1、代码2、配置 五、效果展示 一、IAP简介 IAP介绍可以在网上找找,相关资料很多&am…...
Oracle-—系统包使用
文章目录 系统包dbms_redefinition 系统包 dbms_redefinition 功能介绍:该包体可以实现将Oracle库下的表在线改为分区结构或者重新定义; 说明:在检查表是否可以重定义和开始重定义的过程中,按照表是否存在主键,参数 o…...
使用Hugo和GitHub Pages创建静态网站个人博客
不需要服务器,不需要域名,不需要数据库,可以选择模版,内容为Markdown格式。 Hugo:https://gohugo.io 文档:https://gohugo.io/getting-started/quick-start/ 中文文档:https://www.gohugo.or…...
群晖系统证书延期
群晖系统默认证书过期了 接下来操作续期证书 一直下一步会让下载一个压缩包里面包含私钥和签发证书请求 下载后解压出来 在群晖里用证书续期 对以前的证书签署签发请求 选择刚刚解压出来的证书 执行完成后会下载一个压缩包,解压出来就会得到新证书 给群晖新增证书 选…...
android shader gl_Position是几个分量
在Android的OpenGL ES中,gl_Position是顶点着色器(Vertex Shader)的一个内置输出变量,它用于指定顶点在裁剪空间(Clip Space)中的位置。gl_Position是一个四维向量(4-component vectorÿ…...
JAVA练习-ArrayList数组
需求 建立3个Student类的实例 原始数组: public class Student {private String name;private int score;public Student(String name, int score) {this.name name;this.score score;}Overridepublic String toString() {return name "的分数࿱…...
springboot339javaweb的新能源充电系统pf(论文+源码)_kaic
毕 业 设 计(论 文) 题目:新能源充电系统的设计与实现 摘 要 如今社会上各行各业,都喜欢用自己行业的专属软件工作,互联网发展到这个时候,人们已经发现离不开了互联网。新技术的产生,往往能解…...
数据结构——排序第三幕(深究快排(非递归实现)、快排的优化、内省排序,排序总结)超详细!!!!
文章目录 前言一、非递归实现快排二、快排的优化版本三、内省排序四、排序算法复杂度以及稳定性的分析总结 前言 继上一篇博客基于递归的方式学习了快速排序和归并排序 今天我们来深究快速排序,使用栈的数据结构非递归实现快排,优化快排(三路…...
Jackson:Java对象和JSON字符串的转换处理库使用指南
Jackson介绍 Jackson 是一个非常流行的 Java JSON 处理库,它能够将 Java 对象与 JSON 字符串相互转换。 Jackson 工具主要用于将请求的参数(例如前端发送的 JSON 数据)和响应的数据(例如后端返回给前端的数据)转换成…...
mac maven编译出现问题
背景 进行maven install 命令,报错: [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a J…...
深入讲解Spring Boot和Spring Cloud,外加图书管理系统实战!
很抱歉,我的疏忽,说了这么久还没有给大家详细讲解过Spring Boot和Spring Cloud,那今天给大家详细讲解一下。 大家可以和下面这三篇博客一起看: 1、Spring Boot 和 Spring Cloud 微服务开发实践详解https://blog.csdn.net/speaking_me/artic…...
【AIGC】2023-ICCV-用于高保真语音肖像合成的高效区域感知神经辐射场
2023-ICCV-Efficient Region-Aware Neural Radiance Fields for High-Fidelity Talking Portrait Synthesis 用于高保真语音肖像合成的高效区域感知神经辐射场摘要1. 引言2. 相关工作3. 方法3.1 准备工作和问题设置3.2 三平面哈希表示3.3. 区域注意模块3.4 训练细节 4. 实验4.1…...
如何写一份优质技术文档
作者简介: 本文作者拥有区块链创新专利30,是元宇宙标准化工作组成员、香港web3标准工作组成员,参与编写《数据资产确权与交易安全评价标准》、《链接元宇宙:应用与实践》、《香港Web3.0标准化白皮书》等标准,下面提供…...
ML 系列:第 35 节 - 机器学习中的数据可视化
ML 系列:第 35 天 - 机器学习中的数据可视化 文章目录 一、说明二、数据可视化2.1 直方图2.2 箱线图2.3 散点图2.4 条形图2.5 线图2.6 热图 三、结尾 一、说明 描述性统计和数据可视化是理解和解释机器学习数据的基础。它们有助于总结和直观地呈现数据,…...
存储服务器一般做是做什么阵列?详细列举一下
存储服务器通常使用 RAID(Redundant Array of Independent Disks) 阵列技术来管理磁盘,以提高数据的性能、可靠性和可用性。所选择的 RAID 类型取决于存储服务器的具体用途和需求,比如性能要求、容量需求、容错能力等。 以下是存…...
uniapp使用扩展组件uni-data-select出现的问题汇总
前言 不知道大家有没有学习过我的这门课程那,《uniCloud云开发Vue3版本官方推荐用法》,这么课程已经得到了官方推荐,想要快速上手unicloud的小伙伴们,可以学习一下这么课程哦,不要忘了给一键三连呀。 在录制这门课程…...
pdf.js 预览pdf的时候发票数据缺失显示不全:字体加载出错(缺失)导致部分缺失
首先,排除后端返回的PDF文件流是没有问题的: 但是在vue项目中是这样的: 明显是显示不全,F12查看报错信息,有以下警告: pdf.js:2153 Warning: Error during font loading: The CMap “baseUrl” paramet…...
【设计模式】【结构型模式(Structural Patterns)】之外观模式(Facade Pattern)
1. 设计模式原理说明 外观模式(Facade Pattern) 是一种结构型设计模式,它提供了一个统一的接口,用来访问子系统中的一群接口。外观模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。通过隐藏子系统的复杂…...
Redis使用场景-缓存-缓存穿透
前言 之前在针对实习面试的博文中讲到Redis在实际开发中的生产问题,其中缓存穿透、击穿、雪崩在面试中问的最频繁,本文加了图解,希望帮助你更直观的了解缓存穿透😀 (放出之前写的针对实习面试的关于Redis生产问题的博…...
介绍 Apache Spark 的基本概念和在大数据分析中的应用
Apache Spark 是一个开源的大数据处理框架,它提供了快速、通用、可扩展的数据处理能力。Spark可以处理大规模数据集,并且在内存中进行数据操作,从而实现高速的数据处理和分析。 Spark的核心概念是弹性分布式数据集(Resilient Dis…...
OpenCPN-插件之Dashboard Tactics
1:相关链接Dashboard Tactics :: OpenCPN Dashboard Tactics Plugin rgleason/dashboard_tactics_pi: OpenCPN dashboard built-in plugin merger with external tactics_pi plugin NMEAconverter :: OpenCPN 2:显示样式 3:代码 这个插件…...
【LeetCode面试150】——20有效的括号
博客昵称:沈小农学编程 作者简介:一名在读硕士,定期更新相关算法面试题,欢迎关注小弟! PS:哈喽!各位CSDN的uu们,我是你的小弟沈小农,希望我的文章能帮助到你。欢迎大家在…...
JWT介绍和结合springboot项目实践(登录、注销授权认证管理)
目录 一、JWT介绍(一)基本介绍(二)jwt有哪些库1、jjwt(Java JWT)2、nimbus - jwt - jwt - api 和 nimbus - jwt - jwt - impl3、spring - security - jwt(已弃用,但在旧项目中有参考…...
Linux 下安装 Golang环境
Linux 下安装 Golang 获取Golang下载地址 安装 进入终端,登入root来到应用安装目录使用 wget 下载解压文件配置环境变量查看golang版本,测试是否配置成功GO设置代理环境变量 本篇教程 以 centos7 为环境基础 不使用软件包管理器安装,原因&am…...