Java高级知识复习----IO流

IO流-四种基类IO流详解(InputStream/OutputStream/Reader/Writer)以及mark()和reset()特殊的点 目录 : 四大基类: InputStream(字节输入流) OutputStream(字节输出流) Reader(字符输入流) Writer(字符输出流) mark()和reset()方法详解: mark()和reset()方法详解 JAVA中mark()和reset()用法的通俗理解 如何复制一个文件: 用IO流相关操作复制一个文本 InputStream(字节输入流):基于FileInpu... 阅读详情

1.字符流输入流输出流,实现文本文件的复制

package top.oneluckyguy.thread;

import org.junit.Test;

import java.io.*;

/**
 * @author Liu Qingfeng
 * @create 2020-12-18----21:30
 */
public class FileReaderWritertest {
    public static void main(String[] args) {
        File file = new File("hello.txt");//相较于当前工程下
        System.out.println(file.getAbsolutePath());
    }
    /*
    将文件读入到程序中,并输出到控制台。

    知识点:
    1.read()的理解,返回读入的一个字符,如果到达文件末尾就返回-1
    2.异常的处理:为了保证流的资源一定关闭,最好使用try_catch_finally来捕获异常。

    * */

    @Test
    public void testFileReader() {
        FileReader fileReader = null;
        try {
            //        1.实例化File类的对象,并指明要操作的文件
            File file = new File("src//top//oneluckyguy//pro//hello.txt");//相较于当前Module下
//        2.提供具体的流
            fileReader = new FileReader(file);
//        3.数据的读入
            //read()返回读入的一个字符,如果达到文件末尾,返回-1
       /* 方式一
        int  data = fileReader.read();
        while(data != -1){
            System.out.println((char)(data));
            data = fileReader.read();
        }*/
            //方式二
            int data;
            while((data = fileReader.read()) != -1){
                System.out.println((char)data);
            }
        }catch (IOException e){
            e.printStackTrace();
        }finally {

            //4.流的关闭
            if (fileReader != null){
                try {
                    fileReader.close();
                }catch (IOException e){
                    e.printStackTrace();
                }
            }

        }
    }
    @Test
    public void testFileReader1() throws IOException {
        FileReader fileReader = null;
        try {
            //1.File类的实例化
            File file = new File("src//top//oneluckyguy//pro//hello.txt");
            //2.FileReader流的实例化
            fileReader = new FileReader(file);
            //3.读入的操作
            //read(char[] cbuffer):返回每次读入cbuffer数组中的字符个数,如果达到文件末尾就返回-1
            char[] cbuffer = new char[5];
            int len;
            while ((len = fileReader.read(cbuffer)) != -1 ){
                //方式一
                // 如果是len.length输出为helloworld123ld,123会把world中的前三个字母覆盖,但是后三个不会覆盖,还是输出
                /*for (int i = 0; i < len; i++) {//这里是小于len不是小于len.length。
                    System.out.println(cbuffer[i]);
                }*/
                //方式二
                String string = new String(cbuffer,0,len);//如果这里不加0和len也会出现上面的错误
                System.out.println(string);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fileReader != null){
                try {
                    fileReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /*
    * 从内存中写出数据到硬盘的文件里
    * */
    @Test
    public void testFileWriter()  {
        FileWriter fileWriter = null;
        try {
//        1.提供File类的对象指明要写出的文件
            File file = new File("src//top//oneluckyguy//pro//hello1.txt");
//        2.提供FileWriter的对象,用于数据的写出
            fileWriter = new FileWriter(file,true);//加上true表示在原有文件上追加内容
//        3.写出操作
            fileWriter.write("I have a dream\n");
            fileWriter.write("You are beautiful");
//        4.流的关闭
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fileWriter != null){
                    fileWriter.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
    /*
    * 实现文件的复制
    * */
    @Test
    public void testImgWriter(){
        FileWriter fileWriter = null;
        FileReader fileReader = null;
        try {
//        1.创建File对象,指明要对如和写出的文件
            File fileR = new File("src//top//oneluckyguy//pro//2.png");
            File fileW = new File("src//top//oneluckyguy//pro//3.png");
//        2.创建输入流和输出流的对象
            fileReader = new FileReader(fileR);
            fileWriter = new FileWriter(fileW);
//        3.数据的读入和写出操作
            char[] cbuffer = new char[5];
            int len;
            while ((len = fileReader.read(cbuffer)) != -1){
                for (int i = 0; i < len; i++) {
                    fileWriter.write(cbuffer[i]);
                }

            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {

            try {
                if (fileWriter != null)
                fileWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if (fileReader != null)
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }

}

2.字节流输入输出流实现图片复制

package top.oneluckyguy.io;

import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author Liu Qingfeng
 * @create 2020-12-19----15:11
 * 测试FileInputStream 和FileOutputStream的使用
 * 结论:
 *      对于文本文件使用字符流处理(.txt .doc .c .cpp .java)
 *      对于非文本文件使用字节流处理(视频 音频 .ppt)
 */
public class FileInputOutputStreamTest {
    //使用字节流处理文本文件是可能出现乱码的
    @Test
    public void testFileInputStream(){
        FileInputStream fileInputStream = null;
        try {
            //1.造文件
            File file = new File("hello.txt");
            //2.造流
            fileInputStream = new FileInputStream(file);
            //3.读数据
            byte[] cbuffer = new byte[5];
            int len = 0;
            while((len = fileInputStream.read(cbuffer)) != -1){
                String str = new String(cbuffer,0,len);
                System.out.println(str);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fileInputStream != null){
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
    @Test
    public void testInputOutputStream(){
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        try {
            //1.造文件
            File fileI = new File("2.png");
            File fileO = new File("3.png");
            //2.造流
            fileInputStream = new FileInputStream(fileI);
            fileOutputStream = new FileOutputStream(fileO);
            //3.读写的过程
            byte[] buffer = new byte[5];
            int len;
            while((len = fileInputStream.read(buffer)) != -1){
                fileOutputStream.write(buffer,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(fileOutputStream != null){
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if (fileInputStream != null){
                    fileInputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    //指定路径下文件的复制
    public void copyFile(String srcPath,String destPath){
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        try {
            //1.造文件
            File fileI = new File(srcPath);
            File fileO = new File(destPath);
            //2.造流
            fileInputStream = new FileInputStream(fileI);
            fileOutputStream = new FileOutputStream(fileO);
            //3.读写的过程
            byte[] buffer = new byte[1024];
            int len;
            while((len = fileInputStream.read(buffer)) != -1){
                fileOutputStream.write(buffer,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(fileOutputStream != null){
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if (fileInputStream != null){
                    fileInputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void testCopyFile(){
        long start = System.currentTimeMillis();
        copyFile("2.png","4.png");
        long end = System.currentTimeMillis();
        System.out.println("复制花费的时间:"+ (end - start));
    }
}

3.缓冲流实现文件复制,速度与节点流比较是否更快。

package top.oneluckyguy.io;

import org.junit.Test;

import java.io.*;

/**
 * @author Liu Qingfeng
 * @create 2020-12-19----16:44
 */
/*
* 实现非文本文件的复制
* */
public class BufferedTest {
    public void BufferedStreamTest (String srcPath,String destPath){
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        try {
            //1.造文件
            File filei = new File(srcPath);
            File fileo = new File(destPath);
            //2.造节点流
            fileInputStream = new FileInputStream(filei);
            fileOutputStream = new FileOutputStream(fileo);
//            3.造缓冲流
            BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
            BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
            //4.操作
            byte[] buffer= new byte[1024];
            int len;
            while((len = bufferedInputStream.read(buffer)) != -1){
                bufferedOutputStream.write(buffer,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //5.关闭流
            if (fileInputStream != null){
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (fileOutputStream != null){
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    @Test
    public void fileBufferedCopyTest(){
        long start = System.currentTimeMillis();
        BufferedStreamTest("2.png","4.png");
        long end = System.currentTimeMillis();
        System.out.println("复制花费的时间:"+ (end - start));
    }
}

4.转换流的使用

InputStreamReader

OutputStreamwriter

package top.oneluckyguy.io;

import org.junit.Test;

import java.io.*;

/**
 * @author Liu Qingfeng
 * @create 2020-12-19----20:39
 * 处理流二:
 * 1.转换流:输入字符流
 * InputStreamReader 将一个字节的输入流转换为字符的输入流
 * OutputStreamWriter 将一个字符的输出流转化为字节的输出流
 * 2.作用:提供字节流与字符流之间的转换
 * 3.解码: 字节 字节数组----->字符数组 字符串
 *   编码: 字符数组 字符串----->字节 字节数组
 * 4.字符集
 *
 *
 */
public class InputStreamReaderTest {
    @Test
    public void test(){
        InputStreamReader inputStreamReader = null;
        try {
            File file = new File("hello.txt");
            FileInputStream fileInputStream = new FileInputStream(file);
            inputStreamReader = new InputStreamReader(fileInputStream,"UTF-8");
            char[] cbuffer = new char[5];
            int len;
            while((len = inputStreamReader.read(cbuffer)) != -1){
                String str = new String(cbuffer,0,len);
                System.out.println(str);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (inputStreamReader != null){
                try {
                    inputStreamReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /*
    * 综合使用InputStreamReader 和OutputStreamWriter
    * 把utf-8文件以utf-8格式读入以gbk格式输出
    * */
    @Test
    public void testAll(){
        InputStreamReader inputStreamReader = null;
        OutputStreamWriter outputStreamWriter = null;
        try {
            File fileI = new File("hello.txt");
            File fileO = new File("rehello.txt");
            FileInputStream fileInputStream = new FileInputStream(fileI);
            FileOutputStream fileOutputStream = new FileOutputStream(fileO);
            inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
            outputStreamWriter = new OutputStreamWriter(fileOutputStream,"gbk");
            char[] cbuffer = new char[5];
            int len;
            while((len = inputStreamReader.read(cbuffer)) != -1){
                outputStreamWriter.write(cbuffer,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (inputStreamReader != null){
                try {
                    inputStreamReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (outputStreamWriter != null){
                try {
                    outputStreamWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

5.对象流

1.对String字符串进行序列化和反序列化的输入输出

package top.oneluckyguy.objectIO;

import org.junit.Test;

import java.io.*;

/**
 * @author Liu Qingfeng
 * @create 2020-12-20----15:29
 * 对象流的使用:
 * 1.ObjectInputStream和ObjectOutputStream
 * 2.作用:用于存储和读取基本数据类型数据或对象的处理流,
 * 3.要想一个Java对象是可序列化的,需要满足相应的要求:详见Person类
 */
public class ObjectInputOutputStreamTest {
    /*
    * 序列化过程,将内存中的Java对象保存到磁盘中或者通过网络传播出去
    * 使用ObjectOutputStram实现
    * */
    @Test
    public void testObjectOutputStream(){
        ObjectOutputStream objectOutputStream = null;
        try {
            objectOutputStream = new ObjectOutputStream(new FileOutputStream("hello.data"));
            objectOutputStream.writeObject(new String("坂井泉水"));
            objectOutputStream.flush();//把缓存中的数据刷新出去
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (objectOutputStream != null){
                try {
                    objectOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /*
    * 反序列化,将磁盘文件中的对象还原为内存中的一个Java对象
    * 需要使用ObjectInputStream
    * */
    @Test
    public void testObjectInputStream(){
        ObjectInputStream objectInputStream = null;
        String str = null;
        try {
            objectInputStream = new ObjectInputStream(new FileInputStream("hello.data"));
            Object obj = objectInputStream.readObject();
            str = (String) obj;
            System.out.println(str);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (objectInputStream != null){
                try {
                    objectInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

2.对Objec对象的序列化和反序列化

①对象类

package top.oneluckyguy.objectIO;

import java.io.Serializable;

/**
 * @author Liu Qingfeng
 * @create 2020-12-20----15:51
 */
public class Person implements Serializable {
    //这里如果不写UID系统会自动给你配一个UID,你序列化时用的UID必须和反序列化的UID一样
    //必须指定UID,如果不指定,对当前类修改的时候就会变化
    public static final long serialVersionUID = 12L;
    
    private String name;
    private int age;



    public  Person(String name,int age){
        this.name = name;
        this.age = age;
    }
    public Person() {
    }

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

    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}

②处理流

package top.oneluckyguy.objectIO;

import org.junit.Test;
import java.io.*;

/**
 * @author Liu Qingfeng
 * @create 2020-12-20----15:29
 * 对象流的使用:
 * 1.ObjectInputStream和ObjectOutputStream
 * 2.作用:用于存储和读取基本数据类型数据或对象的处理流,
 * 3.要想一个Java对象是可序列化的,需要满足相应的要求:详见Person类
 *      1.需要实现接口:Serializable
 *      2.当前类需要提供一个全局常量serialVersionUID
 *      eg: public static final long serialVersionUID = -2228226523704288112L;
 *      3.除了当前Person类需要实现Serializable接口外还要保证其内部所有属性也必须是可序列化的。
 *      (默认情况下,基本数据类型都是可序列化的,同时String类型也是可序列化的)
 *      (如果Person类中有一个别的类Man作为Person类的参数,那么这个类Man也要可序列化实现Serializable接口和提供一个UID(这个UID和Person的不同))。
 * 补充:
 * ObjectOutputStream和ObjectInputStream不能序列化static和transient修饰的成员变量
 * (不会报编译错误,但是数据不会保存。)
 */
public class ObjectInputOutputStreamTest {
    /*
    * 序列化过程,将内存中的Java对象保存到磁盘中或者通过网络传播出去
    * 使用ObjectOutputStram实现
    * */
    @Test
    public void testObjectOutputStream(){
        ObjectOutputStream objectOutputStream = null;
        try {
            objectOutputStream = new ObjectOutputStream(new FileOutputStream("hello.data"));
            objectOutputStream.writeObject(new String("坂井泉水"));
            objectOutputStream.flush();//把缓存中的数据刷新出去
            objectOutputStream.writeObject(new Person("大黑摩季",18));
            objectOutputStream.flush();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (objectOutputStream != null){
                try {
                    objectOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /*
    * 反序列化,将磁盘文件中的对象还原为内存中的一个Java对象
    * 需要使用ObjectInputStream
    * */
    @Test
    public void testObjectInputStream(){
        ObjectInputStream objectInputStream = null;
        String str = null;
        Person person = null;
        try {
            objectInputStream = new ObjectInputStream(new FileInputStream("hello.data"));
            Object obj = objectInputStream.readObject();
            str = (String) obj;

            Object objects =  objectInputStream.readObject();
            person = (Person) objects;

            System.out.println(str);
            System.out.println(person);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (objectInputStream != null){
                try {
                    objectInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

 

金九银十准备季:Java IO流面试题(含答案) 前言 本题集列举了众多IT公司面试真题,对应聘Java程序员职位的常见考点和知识体系都进行的分类和归纳整理。 本题集适合应聘Java和JavaEE职位的程序员作为面试复习、学习和强化的资料,也适合其他程序员作为拓展读物进行阅读。 本题集包含了常见的算法、面试题,也包含了新的高级技术,比如:微服务架构等技术的面试题目。本题集非常全面,对于工作1-5年左右的java程序员面试有非常好的指导作用。 大家也可以访问(直接在线观看最新版的面试题): Java考试_Java笔试题机试题真题讲解_JavaWeb 阅读详情

相关推荐

Java开发者软件公司面试笔试题库大全

Java是一种面向对象的编程语言,以其“一次编写,到处运行”的特性而闻名。理解Java的平台无关性对于每个Java开发者来说至关重要。为了开始Java编程之旅,首先需要搭建开发环境。推荐使用Java Development Kit (JDK),它包含了Java运行环境 (JRE) 和Java编译器 (javac)。JDK的安装方法随操作系统不同而不同,但基本步骤包括下载安装包、配置环境变量、验证安装。设计模式根据其在软件工程中解决的问题可以分为三大类:创建型模式、结构型模式和行为型模式。

weixin_36197669的博客 949

Java字符流inputStream和outputStream(详解read()的返回值到底是什么和write()的byte[]参数)

字节流的作用:字节流一般用于读取或者写入二进制文件,如图片音频文件,还可以处理那些字符流无法正常处理的二进制可执行文件。一般而言只要是非文本数据就应该使用字节流来处理。 因为字符流无法保证非文本数据的完整性;(对这句话的理解以后详细解释) 1,字节输入流InputStream。 public class TestDemo{ public static void main(String ...

yaoyaoyao_123的博客 3384

Java面试笔试题库与详解(附知名企业真题)

Java语言自1995年问世以来,凭借其“一次编写,到处运行”的跨平台特性,成为了IT行业最为广泛使用和认可的编程语言之一。Java不仅在企业级应用开发中占据主导地位,而且在移动应用、大数据处理以及云服务等领域也有着极其重要的地位。在某些情况下,内置的异常类无法充分描述问题,此时可以创建自定义异常。自定义异常需要继承自Exception类(检查型异常)或类(非检查型异常)。自定义异常通常包含额外的信息和行为。为了提供更丰富的错误调试信息,可以使用异常链。

weixin_34520664的博客 644

io读取的输入输出,InputStream ,OutputStream 的read(),write()方法的详细介绍

今天复习io 流 遇到一些问题,分享一下,有关字节的读取,输入操作。 import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Demo { public static void main(String[] args) { //字节的输

奋、博、得 3712

winget安装提示:执行此命令时发生意外错误: InternetOpenUrl() failed. 0x80072efd

当我们使用Winget包管理器安装应用,提示错误:执行此命令时发生意外错误: InternetOpenUrl() failed. 0x80072efd 该怎么处理呢?请听我娓娓道来。

Linux I Tell U 8138

基于DSP28335的Matlab/Simulink代码生成实验七:A/D采样

实验七:讲解如何使用DSP的ADC模块,通过代码生成技术控制DSP进行电流采样,是后续实现电机闭环控制的重要环节。通过简单的实验来熟悉代码生成的过程。最终实现复杂算法代码自动生成,进行高性能电机控制!

m0_73869369的博客 4725

Java(数据,字节数组)输入输出流

Java的数据输入输出流是非常强大的IO,使用它可以使我们的程序更加高效。它封装了很多的函数供我们使用。 import java.io.DataInputStream; import java.io.DataOutputStream; readInt();//读取一个整型 readChar();//读取一个字符 readFloat();//读取一个浮点数 readLine();//读取一行 rea...

weixin_44569845的博客 1024

先进封装技术 Part03---重布线层(RDL)的科普

RDL是一种在芯片封装过程中用于重新分布电气连接的技术。它通过在芯片表面或中介层上形成额外的布线层,重新分配芯片的I/O(输入/输出)位置,以适应不同的封装需求和提高电气连接的灵活性。

阿拉伯梳子的专栏 4703

字节流 FileInputStream和FileOutputStream类 三种读写方法对比概述

文件操作 FileInputStream和FileOutputStream类 三种read方法对比概述流字节流FileInputStream及FileOutputStream类的构造方法代码测试read()以及write()三个方法各自性能及用法第一次读写代码------read()、write()方法第二次读写代码------read(byte[] b)、write(byte[] b)方法第三...

quique的博客 2874

自动化革命:AI在需求分析、代码生成与测试中的深度应用

在2025年的科技浪潮中,人工智能(AI)已不再是实验室中的概念,而是深度渗透至软件开发的全生命周期。从需求分析的精准捕捉,到代码生成的自动化创作,再到测试环节的智能覆盖,AI正以革命性姿态重塑软件工程的核心环节。本文将结合2025年最新数据与行业实践,解析AI如何在这三大领域实现深度应用。

1511

电机转矩、功率与转速:核心关系、公式推导与工程应用指南

在电气传动与自动化控制领域,理解旋转机械的核心物理量是进行设备选型、系统设计和故障诊断的基础。转矩、功率和转速构成了描述电机性能的“铁三角”,它们之间通过经典的物理公式紧密关联。从原理上讲,功率是单位时间内做功的能力,转矩是产生旋转运动的力矩,而转速则决定了运动快慢。这三者的关系(P = T × n / 9550)不仅是理论核心,更是工程实践中的关键计算工具,直接关系到电机的驱动能力、能耗与系统匹配。其技术价值在于,它为从微型伺服电机到大型工业传动系统的设计提供了统一的量化分析框架。在应用场景上,无论是为输

weixin_29184371的博客 258

最全金九银十准备季:Java异常+Java IO与NIO面试题(1),mybatis工作原理面试

无论是哪家公司,都很重视高并发高可用的技术,重视基础,重视JVM。面试是一个双向选择的过程,不要抱着畏惧的心态去面试,不利于自己的发挥。同时看中的应该不止薪资,还要看你是不是真的喜欢这家公司,是不是能真的得到锻炼。其实我写了这么多,只是我自己的总结,并不一定适用于所有人,相信经过一些面试,大家都会有这些感触。最后我整理了一些面试真题资料,技术知识点剖析教程,还有和广大同仁一起交流学习共同进步,还有一些职业经验的分享。本文已被。

2301_82231215的博客 912

springboot&mybatis中数组和字符串数据类型的转换

/前端数组字段//数据库中字段/*与前端交互时使用的get/set*/System.out.println("接收前端数据");/*与前端交互时使用的get/set*//*与数据库交互时使用的get/set*/System.out.println("从数据库中读取数据");/*与数据库交互时使用的get/set*/

l_q_l的专栏 2475

JAVA高级阶段技术总结/知识点梳理/个人总结/关于java-se技术的解析(看法)/面试题解析

char类型只能表示一个字符。为了表示一串字符,使用String的数据类型。String类是Java库中预定义的类,不是基本类型,是引用类型。StringBuilder封装可变的字符串, StringBuilder对象创建后,可以通过调用方法,修改字符串的内容。StringBuilder构造器函数java.util.Date用于封装日期和时间信息。date中的日期为系统的当前时间。重写了toString方法,输出内容为日期。

yu2250084579的博客 340

扩散模型与强化学习(13):In-Context Reward Hacking现象与解决方案

奖励作弊(Reward Hacking)指智能体通过钻规则漏洞而非真正完成任务来最大化奖励信号。以论文编辑实验为例,研究提出“上下文奖励作弊”(ICRH)概念,即模型利用共享上下文钻空子,如盲目添加“正确!”或输出无关内容。实验发现,模型规模扩大可能加剧ICRH,且提示词优化难以根治。与传统奖励作弊不同,ICRH发生在部署阶段,由通用性驱动。应对建议包括多轮测试、多样化反馈及异常场景模拟,但尚无完美解决方案。

沉迷单车的追风少年 1319

redhawk:使用rh_setup.pl产生gsr模板

必须加的option工具会在rh_setup.pl给出提示,按照要求填写即可,另外工具会把所有填写的输入文件和信息放到rh_setup.init文件中,拷贝这个文件可在任何平级运行目录下,直接rh_setup.pl产生gsr以及run sta/dyn/em的脚本。rhsetup.pl -top top_cell_name -vdd_nets VDD 1.2 VDD2 1.2 -vss_nets VSS -frequency 100e6 (100m是默认值)更多学习内容请关注「拾陆楼」知识星球。

m0_61544122的博客 1055

JavaSE知识体系很乱?点击一览

JavaSE知识梳理 目前为止总结到了集合部分,后面还有IO流、多线程、面向编程等,学到之后在进行添加~~,个人总结,有些可能不完整,希望见谅~~ JavaSE体系结构 Java语言初始 Java基础语法 Java流程控制 Java方法 Java数组 Java面向对象 Java异常 Java常用类 Java集合 今天的总结就先到这里,希望对学习Java的大家能够回忆起基础知识,也希望大家有什么补充的可以在评论区补充~~ ...

qq_45729665的博客 439

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Java进阶-思维导图

2509_94010074的博客 193

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Java程序员必备面试八股文(完整版)

这篇Java面试题总结涵盖了12个核心知识点:1)JDK与JRE的区别;2)==与equals的差异;3)final关键字的作用;4)Math取整方法;5)String类型特性;6)字符串创建方式差异;7)字符串操作方法;8)IO流分类;9)JSP作用域;10)BIO/NIO/AIO区别;11)反射机制;12)序列化与克隆。重点解析了字符串处理、对象比较、IO操作等高频考点,同时对比了抽象类与接口的特性差异,并详细说明了深浅拷贝的实现

2401_89221445的博客 1026

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Java IO流复习

文章目录Java.io 字符流Java.io 字节流 Java.io 字符流 Reader类分支: 字符流IO流ReaderCharArrayReaderBufferedReaderLineNumberReaderFilterReaderPushbackReaderInputStreamReaderFileReaderPipedReaderStringReader 类 功能 Rea...

RivenDong 1151

Java学习基础笔记——IO流

Java基础之IO流部分学习

jiangnank的博客 1195

Java技术复习提升 15IO流

先给各位读者致歉 笔者因身体抱恙 未能及时更新 以后会按时更新 和大家一起学习探究~

weixin_60566743的博客 1248
上一篇: JavaWeb项目-----JavaScript
下一篇: Java高级知识复习----Socket网络编程TCP、UDP和URL
Renaissance14th
博客等级 码龄9年 39粉丝 72原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值