输入输出流、字符字节流、NIO

1、对输入输出流、字符字节流的学习,以之前做的批量下载功能为例

批量下载指的是,将多个文件打包到zip文件中,然后下载该zip文件。

1.1下载网络上的文件

代码参考如下:

import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class MultiDownloadByUrlTest {
    public static void main(String[] args) throws IOException {
        //如果zip文件不存在则创建zip
        String localZipFile = "D:/temp/testUrl.zip" ;
        File file = new File(localZipFile);
        if(!file.exists()){
            file.createNewFile();
        }
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(localZipFile));
        byte[] buffer = new byte[1024];
        //要批量下载的文件数组
        String[] urls = new String[] {"http://www.baidu.com/img/PCfb_5bf082d29588c07f842ccde3f97243ea.png",
                "https://img-home.csdnimg.cn/images/20201124032511.png"};
        //依次获取批量下载的文件
        for(int i =0; i<urls.length;i++){
            //从数据库中获取文件的路径和文件名,并放入zip文件中
            String urlFile = urls[i];
            out.putNextEntry(new ZipEntry(i+".png"));
            int len;
            URL url = new URL(urlFile);
            URLConnection conn = url.openConnection();
            InputStream inStream = conn.getInputStream();
            //读入需要下载的文件的内容,打包到zip文件
            while ((len = inStream.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }
            out.closeEntry();
            inStream.close();
        }
        out.close();
    }

}

1.2、下载磁盘中的多个文件到zip文件中

import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class MultiDownloadTest {
    public static void main(String[] args) throws IOException {
        //如果zip文件不存在则创建zip
        String localZipFile = "D:/temp/test.zip" ;
        File file = new File(localZipFile);
        if(!file.exists()){
            file.createNewFile();
        }
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(localZipFile));
        //要批量下载的文件数组
        String[] ids = new String[] {"11.docx","22.xlsx"};
        byte[] buffer = new byte[1024];
        //依次获取批量下载的文件
        for(int i =0; i<ids.length;i++){
            String fileName = ids[i];
            out.putNextEntry(new ZipEntry(fileName));
            int len;
            FileInputStream inStream = new FileInputStream(new File("D:/temp/"+fileName));
            //读入需要下载的文件的内容,打包到zip文件
            while ((len = inStream.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }
            out.closeEntry();
            inStream.close();
        }
        out.close();
    }

}

1.3编写接口,下载该zip文件

Controller类代码如下:

package com.hmblogs.backend.controller;

import com.hmblogs.backend.util.MultiDownloadTest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

@RestController
@Slf4j
public class FileController {

    /**
     * get方式下载zip文件
     * @return
     */
    @GetMapping(value = "/downloadZipByGet")
    public void downloadZipByGet(HttpServletRequest request,
                                 HttpServletResponse response) throws IOException {
        log.info("downloadZipByGet prepare begin.");
        MultiDownloadTest.preMultiDownload();
        log.info("downloadZipByGet prepare end.");
        log.info("downloadZipByGet begin.");
        String zipFileName = "D:/temp/test.zip";
        InputStream is = new FileInputStream(new File(zipFileName));
        // 设置response参数,可以打开下载页面
        response.reset();
        response.setContentType("application/octet-stream;charset=utf-8");
        response.setHeader("Access-Control-Expose-Headers", "content-disposition");
        response.setHeader("Content-Disposition", "attachment;filename=test.zip");
        ServletOutputStream out = response.getOutputStream();
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            bis = new BufferedInputStream(is);
            bos = new BufferedOutputStream(out);
            byte[] buff = new byte[2048];
            int bytesRead;
            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                bos.write(buff, 0, bytesRead);
            }
            log.info("downloadZipByGet end.");
        } catch (final IOException e) {
            log.error("downloadZipByGet errors, reason:{}", e.getMessage());
        } finally {
            if (bis != null){
                bis.close();
            }
            if (is != null){
                is.close();
            }
            if (bos != null){
                bos.close();
            }
            if (out != null){
                out.close();
            }
        }
        // 用后删除临时用途的zip文件
        File fileTempZip = new File(zipFileName);
        if(fileTempZip.exists()){
            fileTempZip.delete();
        }
    }

    /**
     * post方式下载zip文件
     * @return
     */
    @RequestMapping(value = "/downloadZipByPost",method = RequestMethod.POST)
    public void downloadZipByPost(){

    }

}

工具类MultiDownloadTest.java代码如下:

package com.hmblogs.backend.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class MultiDownloadTest {
    public static void preMultiDownload() throws IOException {
        //如果zip文件不存在则创建zip
        String localZipFile = "D:/temp/test.zip" ;
        File file = new File(localZipFile);
        if(!file.exists()){
            file.createNewFile();
        }
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(localZipFile));
        //要批量下载的文件数组
        String[] ids = new String[] {"11.docx","22.xlsx"};
        byte[] buffer = new byte[1024];
        //依次获取批量下载的文件
        for(int i =0; i<ids.length;i++){
            String fileName = ids[i];
            out.putNextEntry(new ZipEntry(fileName));
            int len;
            FileInputStream inStream = new FileInputStream(new File("D:/temp/"+fileName));
            //读入需要下载的文件的内容,打包到zip文件
            while ((len = inStream.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }
            out.closeEntry();
            inStream.close();
        }
        out.close();
    }

}

1.4访问接口

http://localhost:8080/backend/downloadZipByGet

下载了文件,能正常打开,且文件都是正常的。

二、学习NIO

参考Java之NIO基本简介_java_脚本之家

2.1开发一个简单的服务端接收客户端发过来的消息的功能

服务端Server.java代码如下:


import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.util.Iterator;
public class Server {
    public static void main(String[] args) {
        try {
            //1.获取管道
            ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
            //2.设置非阻塞模式
            serverSocketChannel.configureBlocking(false);
            //3.绑定端口
            serverSocketChannel.bind(new InetSocketAddress(8888));
            //4.获取选择器
            Selector selector = Selector.open();
            //5.将通道注册到选择器上,并且开始指定监听的接收事件
            serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
            //6.轮询已经就绪的事件
            while (selector.select() > 0){
                System.out.println("开启事件处理");
                //7.获取选择器中所有注册的通道中已准备好的事件
                Iterator<SelectionKey> it = selector.selectedKeys().iterator();
                //8.开始遍历事件
                while (it.hasNext()){
                    SelectionKey selectionKey = it.next();

                    //9.判断这个事件具体是啥
                    if (selectionKey.isAcceptable()){
                        System.out.println("isAcceptable--->"+selectionKey);
                        //10.获取当前接入事件的客户端通道
                        SocketChannel socketChannel = serverSocketChannel.accept();
                        //11.切换成非阻塞模式
                        socketChannel.configureBlocking(false);
                        //12.将本客户端注册到选择器
                        socketChannel.register(selector,SelectionKey.OP_READ);
                    }else if (selectionKey.isReadable()){
                        System.out.println("isReadable--->"+selectionKey);
                        //13.获取当前选择器上的读
                        SocketChannel socketChannel = (SocketChannel) selectionKey.channel();
                        //14.读取
                        ByteBuffer buffer = ByteBuffer.allocate(1024);
                        int len;
                        while ((len = socketChannel.read(buffer)) > 0){
                            buffer.flip();
                            System.out.println(new String(buffer.array(),0,len));
                            //清除之前的数据(覆盖写入)
                            buffer.clear();
                        }
                    }
                    //15.处理完毕后,移除当前事件
                    it.remove();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

客户端Client.java代码如下:

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.Scanner;
public class Client {
    public static void main(String[] args) {
        try {
            SocketChannel socketChannel = SocketChannel.open(new InetSocketAddress("127.0.0.1",8888));
            socketChannel.configureBlocking(false);
            ByteBuffer buffer = ByteBuffer.allocate(1024);
            Scanner scanner = new Scanner(System.in);
            while (true){
                System.out.print("请输入:");
                String msg = scanner.nextLine();
                buffer.put(msg.getBytes());
                buffer.flip();
                socketChannel.write(buffer);
                buffer.clear();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

运行Server

然后运行Client

在Client输入wwww

然后看到Server打印如下内容:

开启事件处理
isAcceptable--->sun.nio.ch.SelectionKeyImpl@42110406
开启事件处理
isReadable--->sun.nio.ch.SelectionKeyImpl@531d72ca
wwww

可以看到, 这时先开启了isAcceptable事件处理,然后开启了isReadable事件处理。

然后再在Client输入qqqq

然后看到Server打印如下内容:

开启事件处理
isReadable--->sun.nio.ch.SelectionKeyImpl@531d72ca
qqqq

这时只开启了isReadable这样的事件处理,不用再开启isAcceptable事件处理

server控制台截图如下

client的控制台如下: 

2.2开发网络编程应用实例-群聊系统

需求:进一步理解 NIO 非阻塞网络编程机制,实现多人群聊

 编写一个 NIO 群聊系统,实现客户端与客户端的通信需求(非阻塞)

服务器端:可以监测用户上线,离线,并实现消息转发功能

客户端:通过 channel 可以无阻塞发送消息给其它所有客户端用户,同时可以接受其它客户端用户通过服务端转发来的消息

Server.java代码如下:


import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.util.Iterator;
/**
 *
 */
public class Server {
    //定义属性
    private Selector selector;
    private ServerSocketChannel ssChannel;
    private static final int PORT = 9999;
    //构造器
    //初始化工作
    public Server() {
        try {
            // 1、获取通道
            ssChannel = ServerSocketChannel.open();
            // 2、切换为非阻塞模式
            ssChannel.configureBlocking(false);
            // 3、绑定连接的端口
            ssChannel.bind(new InetSocketAddress(PORT));
            // 4、获取选择器Selector
            selector = Selector.open();
            // 5、将通道都注册到选择器上去,并且开始指定监听接收事件
            ssChannel.register(selector , SelectionKey.OP_ACCEPT);
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
    //监听
    public void listen() {
        System.out.println("监听线程:" + Thread.currentThread().getName());
        try {
            while (selector.select() > 0){
                // 7、获取选择器中的所有注册的通道中已经就绪好的事件
                Iterator<SelectionKey> it = selector.selectedKeys().iterator();
                // 8、开始遍历这些准备好的事件
                while (it.hasNext()){
                    // 提取当前这个事件
                    SelectionKey sk = it.next();
                    // 9、判断这个事件具体是什么
                    if(sk.isAcceptable()){
                        // 10、直接获取当前接入的客户端通道
                        SocketChannel schannel = ssChannel.accept();
                        // 11 、切换成非阻塞模式
                        schannel.configureBlocking(false);
                        // 12、将本客户端通道注册到选择器
                        System.out.println(schannel.getRemoteAddress() + " 上线 ");
                        schannel.register(selector , SelectionKey.OP_READ);
                        //提示
                    }else if(sk.isReadable()){
                        //处理读 (专门写方法..)
                        readData(sk);
                    }
                    it.remove(); // 处理完毕之后需要移除当前事件
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            //发生异常处理....
        }
    }
    //读取客户端消息
    private void readData(SelectionKey key) {
        //获取关联的channel
        SocketChannel channel = null;
        try {
            //得到channel
            channel = (SocketChannel) key.channel();
            //创建buffer
            ByteBuffer buffer = ByteBuffer.allocate(1024);
            int count = channel.read(buffer);
            //根据count的值做处理
            if(count > 0) {
                //把缓存区的数据转成字符串
                String msg = new String(buffer.array());
                //输出该消息
                System.out.println("来自客户端---> " + msg);
                //向其它的客户端转发消息(去掉自己), 专门写一个方法来处理
                sendInfoToOtherClients(msg, channel);
            }
        }catch (IOException e) {
            try {
                System.out.println(channel.getRemoteAddress() + " 离线了..");
                e.printStackTrace();
                //取消注册
                key.cancel();
                //关闭通道
                channel.close();
            }catch (IOException e2) {
                e2.printStackTrace();;
            }
        }
    }
    //转发消息给其它客户(通道)
    private void sendInfoToOtherClients(String msg, SocketChannel self ) throws  IOException{
        System.out.println("服务器转发消息中...");
        System.out.println("服务器转发数据给客户端线程: " + Thread.currentThread().getName());
        //遍历 所有注册到selector 上的 SocketChannel,并排除 self
        for(SelectionKey key: selector.keys()) {
            //通过 key  取出对应的 SocketChannel
            Channel targetChannel = key.channel();
            //排除自己
            if(targetChannel instanceof  SocketChannel && targetChannel != self) {
                //转型
                SocketChannel dest = (SocketChannel)targetChannel;
                //将msg 存储到buffer
                ByteBuffer buffer = ByteBuffer.wrap(msg.getBytes());
                //将buffer 的数据写入 通道
                dest.write(buffer);
            }
        }
    }
    public static void main(String[] args) {
        //创建服务器对象
        Server groupChatServer = new Server();
        groupChatServer.listen();
    }
}

Client.java代码如下:


import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Scanner;
public class Client {
    //定义相关的属性
    private final String HOST = "127.0.0.1"; // 服务器的ip
    private final int PORT = 9999; //服务器端口
    private Selector selector;
    private SocketChannel socketChannel;
    private String username;
    //构造器, 完成初始化工作
    public Client() throws IOException {
        selector = Selector.open();
        //连接服务器
        socketChannel = socketChannel.open(new InetSocketAddress("127.0.0.1", PORT));
        //设置非阻塞
        socketChannel.configureBlocking(false);
        //将channel 注册到selector
        socketChannel.register(selector, SelectionKey.OP_READ);
        //得到username
        username = socketChannel.getLocalAddress().toString().substring(1);
        System.out.println(username + " is ok...");
    }
    //向服务器发送消息
    public void sendInfo(String info) {
        info = username + " 说:" + info;
        try {
            socketChannel.write(ByteBuffer.wrap(info.getBytes()));
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
    //读取从服务器端回复的消息
    public void readInfo() {
        try {
            int readChannels = selector.select();
            if(readChannels > 0) {//有可以用的通道
                Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();
                while (iterator.hasNext()) {
                    SelectionKey key = iterator.next();
                    if(key.isReadable()) {
                        //得到相关的通道
                        SocketChannel sc = (SocketChannel) key.channel();
                        //得到一个Buffer
                        ByteBuffer buffer = ByteBuffer.allocate(1024);
                        //读取
                        sc.read(buffer);
                        //把读到的缓冲区的数据转成字符串
                        String msg = new String(buffer.array());
                        System.out.println(msg.trim());
                    }
                }
                iterator.remove(); //删除当前的selectionKey, 防止重复操作
            } else {
                //System.out.println("没有可以用的通道...");
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) throws Exception {
        //启动我们客户端
        Client chatClient = new Client();
        //启动一个线程, 每个3秒,读取从服务器发送数据
        new Thread() {
            public void run() {
                while (true) {
                    chatClient.readInfo();
                    try {
                        Thread.currentThread().sleep(3000);
                    }catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
        //发送数据给服务器端
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            System.out.print("请输入:");
            String s = scanner.nextLine();
            chatClient.sendInfo(s);
        }
    }
}

Client22.java代码如下:就是Client.java的代码复制一份,改下文件名而已。


import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Scanner;

public class Client22 {
    //定义相关的属性
    private final String HOST = "127.0.0.1"; // 服务器的ip
    private final int PORT = 9999; //服务器端口
    private Selector selector;
    private SocketChannel socketChannel;
    private String username;
    //构造器, 完成初始化工作
    public Client22() throws IOException {
        selector = Selector.open();
        //连接服务器
        socketChannel = socketChannel.open(new InetSocketAddress("127.0.0.1", PORT));
        //设置非阻塞
        socketChannel.configureBlocking(false);
        //将channel 注册到selector
        socketChannel.register(selector, SelectionKey.OP_READ);
        //得到username
        username = socketChannel.getLocalAddress().toString().substring(1);
        System.out.println(username + " is ok...");
    }
    //向服务器发送消息
    public void sendInfo(String info) {
        info = username + " 说:" + info;
        try {
            socketChannel.write(ByteBuffer.wrap(info.getBytes()));
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
    //读取从服务器端回复的消息
    public void readInfo() {
        try {
            int readChannels = selector.select();
            if(readChannels > 0) {//有可以用的通道
                Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();
                while (iterator.hasNext()) {
                    SelectionKey key = iterator.next();
                    if(key.isReadable()) {
                        //得到相关的通道
                        SocketChannel sc = (SocketChannel) key.channel();
                        //得到一个Buffer
                        ByteBuffer buffer = ByteBuffer.allocate(1024);
                        //读取
                        sc.read(buffer);
                        //把读到的缓冲区的数据转成字符串
                        String msg = new String(buffer.array());
                        System.out.println(msg.trim());
                    }
                }
                iterator.remove(); //删除当前的selectionKey, 防止重复操作
            } else {
                //System.out.println("没有可以用的通道...");
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) throws Exception {
        //启动我们客户端
        Client22 chatClient = new Client22();
        //启动一个线程, 每个3秒,读取从服务器发送数据
        new Thread() {
            public void run() {
                while (true) {
                    chatClient.readInfo();
                    try {
                        Thread.currentThread().sleep(3000);
                    }catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();
        //发送数据给服务器端
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            System.out.print("请输入:");
            String s = scanner.nextLine();
            chatClient.sendInfo(s);
        }
    }
}

启动Server、Client、Client22后,在Client输入内容、在Client22输入内容后,对3个控制台截图如下

Server控制台截图如下:

Client控制台如下:

Client22控制台如下:

 

简单的需求目的达到了。 

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2023三星齐发,博客之星、华为OD、Java学习星球

大家好&#xff0c;我是哪吒。 一、回顾2023 2023年&#xff0c;华为OD成了我的主旋律&#xff0c;一共发布了561篇文章&#xff0c;其中包含 368篇华为OD机试的文章&#xff1b;100篇Java基础的文章40多篇MongoDB、Redis的文章&#xff1b;30多篇数据库的文章&#xff1b;2…

创建第一个SpringMVC项目,入手必看!

文章目录 创建第一个SpringMVC项目&#xff0c;入手必看&#xff01;1、新建一个maven空项目&#xff0c;在pom.xml中设置打包为war之前&#xff0c;右击项目添加web框架2、如果点击右键没有添加框架或者右击进去后没有web框架&#xff0c;点击左上角file然后进入项目结构在模块…

MES系统精准把控生产全过程,按期交货不再难

当订单交期较短时且物料异常较大时物料会存在供应商交期困难&#xff0c;PMC在下PR单时需注明原因&#xff0c;同时要求采购紧急回复&#xff0c;PMC将最终交期知会相关部门。若为PMC漏单&#xff0c;则需注明情况并且作紧急物料处理确保订单正常出货。PMC每周需将紧急物料列出…

New!2024最新ChatGPT提示词开源项目:GPT Prompts Hub - 专注于深化对话质量和探索更复杂的对话结构

&#x1f31f; GPT Prompts Hub &#x1f31f; 欢迎来到 “GPT Prompts Hub” 存储库&#xff01;探索并分享高质量的 ChatGPT 提示词。培养创新性内容&#xff0c;提升对话体验&#xff0c;激发创造力。我们极力鼓励贡献独特的提示词。 在 “GPT Prompts Hub” 项目中&#…

LeetCode-58/709

1.最后一个单词的长度&#xff08;58&#xff09; 题目描述&#xff1a; 给你一个字符串 s&#xff0c;由若干单词组成&#xff0c;单词前后用一些空格字符隔开。返回字符串中 最后一个 单词的长度。 单词 是指仅由字母组成、不包含任何空格字符的最大子字符串。 思路&…

是时候扔掉cmder, 换上Windows Terminal

作为一个Windows的长期用户&#xff0c;一直没有给款好用的终端&#xff0c;知道遇到了 cmder&#xff0c;它拯救一个习惯用Windows敲shell命令的人。 不用跟我安利macOS真香&#xff01;公司上班一直用macOS&#xff0c;一方面确实更加习惯windows下面学习, 另一方面是上课需要…

Large Language Models Paper 分享

论文1&#xff1a; ChatGPTs One-year Anniversary: Are Open-Source Large Language Models Catching up? 简介 2022年11月&#xff0c;OpenAI发布了ChatGPT&#xff0c;这一事件在AI社区甚至全世界引起了轰动。首次&#xff0c;一个基于应用的AI聊天机器人能够提供有帮助、…

一文初步了解slam技术

本文初步介绍slam技术&#xff0c;主要是slam技术的概述&#xff0c;涉及技术原理、应用场景、分类、以及各自优缺点&#xff0c;和slam技术的未来展望。 &#x1f3ac;个人简介&#xff1a;一个全栈工程师的升级之路&#xff01; &#x1f4cb;个人专栏&#xff1a;slam精进之…

Hyperledger Fabric Java App Demo

编写一个应用程序来连接到 fabrc 网络中&#xff0c;通过调用智能合约来访问账本. fabric gateway fabric gateway 有两个项目&#xff0c;一个是 fabric-gateway-java , 一个是 fabric-gateway。 fabric-gateway-java 是比较早的项目&#xff0c;使用起来较为麻烦需要提供一…

【JaveWeb教程】(12) 一篇文章教你轻松搞定IDEA集成Maven(最详细)

目录 03. IDEA集成Maven3.1 配置Maven环境3.1.1 当前工程设置3.1.2 全局设置 3.2 Maven项目3.2.1 创建Maven项目3.2.2 POM配置详解3.2.3 Maven坐标详解 3.3 导入Maven项目 03. IDEA集成Maven 我们要想在IDEA中使用Maven进行项目构建&#xff0c;就需要在IDEA中集成Maven 3.1 …

Bedrock Base推出Gal 01,一款专为个人用户设计的AI人工智能电脑

Bedrock Base 是一个为高效团队设计的协作工作环境。它的主要用途是帮助团队更快、更好地进行创作和合作。 Bedrock Base 可以对各行各业的团队都有帮助和影响。无论是科技行业、创意行业、媒体行业还是其他行业&#xff0c;团队都可以利用 Bedrock Base 的功能来更高效地组织…

云仓酒庄带大家识破葡萄酒的谣言

在葡萄酒世界里&#xff0c;有的刚入门&#xff0c;有的没入门&#xff0c;于是对于葡萄酒知识一知半解&#xff0c;很容易道听涂说&#xff0c;甚至对一些属于误解或谣言都深信不疑。所以&#xff0c;云仓酒庄有必要给大家辟辟谣。 谣言1&#xff1a;只有红葡萄酒具有陈年潜力…

气缸功能块(SMART PLC梯形图代码)

有关气缸功能块的更多介绍,可以参考下面链接文章: https://rxxw-control.blog.csdn.net/article/details/125459568https://rxxw-control.blog.csdn.net/article/details/125459568CODESYS平台双通气缸功能块 https://rxxw-control.blog.csdn.net/article/details/12544822…

网络字节序与主机字节序

字节序区分 多字节的数值在内存中高低位的排列方式会影响所表示的数值处理方式和显示。字节序以字节为基本单位&#xff0c;表示不同字节的存储顺序。 从存储顺序上区分&#xff0c;可分为大端字节序和小端字节序。从处理上区分&#xff0c;可区分为网络字节序和主机字节序。…

Java面试高招:程序员如何在面试中脱颖而出

Java面试高招&#xff1a;程序员如何在面试中脱颖而出 《Java面试高招&#xff1a;程序员如何在面试中脱颖而出》摘要引言面试经历面试失败的反思 面试技巧侦探式的问题解决无敌铁金刚的坚定决心 参考资料 博主 默语带您 Go to New World. ✍ 个人主页—— 默语 的博客&#x1…

test mutation-03-变异测试 mujava Mutation 入门

拓展阅读 开源 Auto generate mock data for java test.(便于 Java 测试自动生成对象信息) 开源 Junit performance rely on junit5 and jdk8.(java 性能测试框架。性能测试。压测。测试报告生成。) test 系统学习-04-test converate 测试覆盖率 jacoco 原理介绍 Java (muJ…

基于SSM酒店后台管理系统【源码】【最详细运行文档】

基于SSM酒店后台管理系统【源码】【最详细运行文档】 功能简介技术描述运行准备♝项目运行访问项目 演示图✅源码获取 &#x1f4a1; 「分享」 大家好&#xff0c;最近几年在酒店后台管理系统非常流行&#xff0c;无论是上课的项目或者是一些毕设都会以酒店后台管理系统举例说…

猫头虎分享已解决Bug || 解决Vue.js not detected的问题 ️

博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大全》 — 面试准备的宝典&#xff01;《IDEA开发秘籍》 — 提升你的IDEA技能&#xff01;《100天精通Golang》…

任务调度中心

可以服务器配置和权限&#xff0c;分配任务执行。当服务器下线后&#xff0c;任务会被在线服务器接管&#xff0c;当重新上线后会在次执行任务。接管任务的服务器会释放任务。调度过程的实现&#xff0c;可以二次开发。基于 netty tcp 通信开发。 下载地址&#xff1a; http:/…

Android Canvas图层saveLayer剪切clipPath原图addCircle绘制对应圆形区域,Kotlin(2)

Android Canvas图层saveLayer剪切clipPath原图addCircle绘制对应圆形区域&#xff0c;Kotlin&#xff08;2&#xff09; 在 Android Canvas图层saveLayer剪切clipRect原图对应Rect区域&#xff0c;Kotlin&#xff08;1&#xff09;-CSDN博客 的基础上&#xff0c;把矩形切图&a…