五一放假了,作为一个外地狗,就别想回家了,还是在学校搞点东西吧!花了一天的时间,写了一个比较完善的文件管理工具类,希望小伙伴们能用上,有关于文件的常见操作,,一个我们知道,在Android开发过程中,和文件打交道是很频繁的,一个好的工具类可以帮你提高开发的效率,简单了开发的过程和优化代码,这就是我的工具代码了,拷贝在你的项目中就可以直接用了,使用也挺方便的,每个方法都有说明,但是使用的时候记得给权限哈!
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" >
</uses-permission>

文件工具类
`
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
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.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;

public class FileUtil{

/**
 * 删除文件
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件名,要在系统内保持唯�?
 * @return boolean 存储成功的标�?
 */
public static boolean deleteFile(Context context, String fileName)
{
    return context.deleteFile(fileName);
}

/**
 * 文件是否存在
 * 
 * @param context
 * @param fileName
 * @return
 */
public static boolean exists(Context context, String fileName)
{
    return new File(context.getFilesDir(), fileName).exists();
}

/**
 * 存储文本数据
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件名,要在系统内保持唯�?
 * @param content
 *            文本内容
 * @return boolean 存储成功的标�?
 */
public static boolean writeFile(Context context, String fileName, String content)
{
    boolean success = false;
    FileOutputStream fos = null;
    try
    {
        fos = context.openFileOutput(fileName, Context.MODE_PRIVATE);
        byte[] byteContent = content.getBytes();
        fos.write(byteContent);
        success = true;
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    finally
    {
        try
        {
            if (fos != null) fos.close();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
    }

    return success;
}

/**
 * 存储文本数据
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件名,要在系统内保持唯�?
 * @param content
 *            文本内容
 * @return boolean 存储成功的标�?
 */
public static boolean writeFile(String filePath, String content)
{
    boolean success = false;
    FileOutputStream fos = null;
    try
    {
        fos = new FileOutputStream(filePath);
        byte[] byteContent = content.getBytes();
        fos.write(byteContent);
        success = true;
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    finally
    {
        try
        {
            if (fos != null) fos.close();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
    }

    return success;
}

/**
 * 读取文本数据
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件�?
 * @return String, 读取到的文本内容,失败返回null
 */
public static String readFile(Context context, String fileName)
{
    if (!exists(context, fileName)) { return null; }
    FileInputStream fis = null;
    String content = null;
    try
    {
        fis = context.openFileInput(fileName);
        if (fis != null)
        {
            byte[] buffer = new byte[1024];
            ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
            while (true)
            {
                int readLength = fis.read(buffer);
                if (readLength == -1) break;
                arrayOutputStream.write(buffer, 0, readLength);
            }
            fis.close();
            arrayOutputStream.close();
            content = new String(arrayOutputStream.toString("utf-8"));

        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
        content = null;
    }
    finally
    {
        try
        {
            if (fis != null) fis.close();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
    }
    return content;
}

/**
 * 读取文本数据
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件�?
 * @return String, 读取到的文本内容,失败返回null
 */
public static String readFile(String filePath)
{
    if (filePath == null || !new File(filePath).exists()) { return null; }
    FileInputStream fis = null;
    String content = null;
    try
    {
        fis = new FileInputStream(filePath);
        if (fis != null)
        {
            byte[] buffer = new byte[1024];
            ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
            while (true)
            {
                int readLength = fis.read(buffer);
                if (readLength == -1) break;
                arrayOutputStream.write(buffer, 0, readLength);
            }
            fis.close();
            arrayOutputStream.close();
            content = new String(arrayOutputStream.toString("utf-8"));

        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
        content = null;
    }
    finally
    {
        try
        {
            if (fis != null) fis.close();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
    }
    return content;
}

/**
 * 读取文本数据
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件�?
 * @return String, 读取到的文本内容,失败返回null
 */
public static String readAssets(Context context, String fileName)
{
    InputStream is = null;
    String content = null;
    try
    {
        is = context.getAssets().open(fileName);
        if (is != null)
        {

            byte[] buffer = new byte[1024];
            ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
            while (true)
            {
                int readLength = is.read(buffer);
                if (readLength == -1) break;
                arrayOutputStream.write(buffer, 0, readLength);
            }
            is.close();
            arrayOutputStream.close();
            content = new String(arrayOutputStream.toString("utf-8"));

        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
        content = null;
    }
    finally
    {
        try
        {
            if (is != null) is.close();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
    }
    return content;
}

/**
 * 存储单个Parcelable对象
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件名,要在系统内保持唯�?
 * @param parcelObject
 *            对象必须实现Parcelable
 * @return boolean 存储成功的标�?
 */
public static boolean writeParcelable(Context context, String fileName, Parcelable parcelObject)
{
    boolean success = false;
    FileOutputStream fos = null;
    try
    {
        fos = context.openFileOutput(fileName, Context.MODE_PRIVATE);
        Parcel parcel = Parcel.obtain();
        parcel.writeParcelable(parcelObject, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
        byte[] data = parcel.marshall();
        fos.write(data);

        success = true;
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    finally
    {
        if (fos != null)
        {
            try
            {
                fos.close();
            }
            catch (IOException ioe)
            {
                ioe.printStackTrace();
            }
        }
    }

    return success;
}

/**
 * 存储List对象
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件名,要在系统内保持唯�?
 * @param list
 *            对象数组集合,对象必须实现Parcelable
 * @return boolean 存储成功的标�?
 */
public static boolean writeParcelableList(Context context, String fileName, List<Parcelable> list)
{
    boolean success = false;
    FileOutputStream fos = null;
    try
    {
        if (list instanceof List)
        {
            fos = context.openFileOutput(fileName, Context.MODE_PRIVATE);
            Parcel parcel = Parcel.obtain();
            parcel.writeList(list);
            byte[] data = parcel.marshall();
            fos.write(data);

            success = true;
        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    finally
    {
        if (fos != null)
        {
            try
            {
                fos.close();
            }
            catch (IOException ioe)
            {
                ioe.printStackTrace();
            }
        }
    }

    return success;
}

/**
 * 读取单个数据对象
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件�?
 * @return Parcelable, 读取到的Parcelable对象,失败返回null
 */
@SuppressWarnings("unchecked")
public static Parcelable readParcelable(Context context, String fileName, ClassLoader classLoader)
{
    Parcelable parcelable = null;
    FileInputStream fis = null;
    ByteArrayOutputStream bos = null;
    try
    {
        fis = context.openFileInput(fileName);
        if (fis != null)
        {
            bos = new ByteArrayOutputStream();
            byte[] b = new byte[4096];
            int bytesRead;
            while ((bytesRead = fis.read(b)) != -1)
            {
                bos.write(b, 0, bytesRead);
            }

            byte[] data = bos.toByteArray();

            Parcel parcel = Parcel.obtain();
            parcel.unmarshall(data, 0, data.length);
            parcel.setDataPosition(0);
            parcelable = parcel.readParcelable(classLoader);
        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
        parcelable = null;
    }
    finally
    {
        if (fis != null) try
        {
            fis.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        if (bos != null) try
        {
            bos.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    return parcelable;
}

/**
 * 读取数据对象列表
 * 
 * @param context
 *            程序上下�?
 * @param fileName
 *            文件�?
 * @return List, 读取到的对象数组,失败返回null
 */
@SuppressWarnings("unchecked")
public static List<Parcelable> readParcelableList(Context context, String fileName, ClassLoader classLoader)
{
    List<Parcelable> results = null;
    FileInputStream fis = null;
    ByteArrayOutputStream bos = null;
    try
    {
        fis = context.openFileInput(fileName);
        if (fis != null)
        {
            bos = new ByteArrayOutputStream();
            byte[] b = new byte[4096];
            int bytesRead;
            while ((bytesRead = fis.read(b)) != -1)
            {
                bos.write(b, 0, bytesRead);
            }

            byte[] data = bos.toByteArray();

            Parcel parcel = Parcel.obtain();
            parcel.unmarshall(data, 0, data.length);
            parcel.setDataPosition(0);
            results = parcel.readArrayList(classLoader);
        }
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
        results = null;
    }
    finally
    {
        if (fis != null) try
        {
            fis.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        if (bos != null) try
        {
            bos.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    return results;
}

public static boolean saveSerializable(Context context, String fileName, Serializable data)
{
    boolean success = false;
    ObjectOutputStream oos = null;
    try
    {
        oos = new ObjectOutputStream(context.openFileOutput(fileName, Context.MODE_PRIVATE));
        oos.writeObject(data);
        success = true;
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        if (oos != null)
        {
            try
            {
                oos.close();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    }
    return success;
}

public static Serializable readSerialLizable(Context context, String fileName)
{
    Serializable data = null;
    ObjectInputStream ois = null;
    try
    {
        ois = new ObjectInputStream(context.openFileInput(fileName));
        data = (Serializable) ois.readObject();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        if (ois != null)
        {
            try
            {
                ois.close();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    }

    return data;
}

/**
 * 从assets里边读取字符�?
 * 
 * @param context
 * @param fileName
 * @return
 */
 public static String getFromAssets(Context context, String fileName)
{
    try
    {
        InputStreamReader inputReader = new InputStreamReader(context.getResources().getAssets().open(fileName));
        BufferedReader bufReader = new BufferedReader(inputReader);
        String line = "";
        String Result = "";
        while ((line = bufReader.readLine()) != null)
            Result += line;
        return Result;
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    return null;
}

 /**
  * 复制文件
  * 
  * @param srcFile
  * @param dstFile
  * @return
  */
 public static boolean copy(String srcFile, String dstFile)
 {
     FileInputStream fis = null;
     FileOutputStream fos = null;
     try
     {

         File dst = new File(dstFile);
         if (!dst.getParentFile().exists())
         {
             dst.getParentFile().mkdirs();
         }

         fis = new FileInputStream(srcFile);
         fos = new FileOutputStream(dstFile);

         byte[] buffer = new byte[1024];
         int len = 0;

         while ((len = fis.read(buffer)) != -1)
         {
             fos.write(buffer, 0, len);
         }

     }
     catch (Exception e)
     {
         e.printStackTrace();
         return false;
     }
     finally
     {
         if (fis != null)
         {
             try
             {
                 fis.close();
             }
             catch (IOException e)
             {
                 e.printStackTrace();
             }
         }
         if (fos != null)
         {
             try
             {
                 fos.close();
             }
             catch (IOException e)
             {
                 e.printStackTrace();
             }
         }

     }
     return true;
 }

}
`
代码有点多,但是都很见名知意,有不足的地方,希望小伙伴们提出,大家一起改进

Android文件操作工具类,拿去用吧!

相关文章

  1. Android UI--ViewPager扩展Tab标签指示,android开发网上购物app

    布局搞定之后&#xff0c;定义一个适配器如下&#xff1a; package com.wwj.viewpager; import java.util.List; import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; /** ViewPager适配器 author wwj */ publi…...

    2023/3/26 18:52:40
  2. Vue基础学习

    引自&#xff1a;https://mrbird.cc/Vue-Learn-Note.html mrbird大佬博客 Vue 入门 <!DOCTYPE html><html lang"en"><head><meta charset"UTF-8"><title>todoList</title><script src"https://cdn.jsdelivr…...

    2023/3/26 18:49:30
  3. DHCP工作原理

    DHCP工作原理图DHCP关键知识点DHCP服务器数据传输的端口为UDP67DHCP客户机数据传输的端口为UDP68客户机的源IP地址为:0.0.0.0客户机的目的IP地址:255.255.255.255DHCP过程详解发现阶段:DHCP客户机获取网络中DHCP服务器信息的阶段提供阶段:DHCP SERVER向DHCP客户机提供预分配…...

    2023/3/26 18:41:22
  4. java笔记7----java中的方法、递归

    1、方法 方法的定义 在程序开发的过程中&#xff0c;会编写到很多重复的代码&#xff0c;&#xff0c;可以使用方法对这些代码进行管理&#xff0c;可以使用方法实现对代的管理和重用(重复使用)&#xff0c;可以把方法理解成一个可以重复多次使用的功能。 方法的格式 在给方法…...

    2023/3/26 18:40:04
  5. 很好用的chrome 插件合集,不要错过

    通用类插件 1、OneTab&#xff1a;将无数 Tab 合并在一个页面 很多时候我们在一个窗口打开太多的tab&#xff0c;每一个tab太小不容易管理&#xff0c;这时候使用OneTab能够把所有tab收起放在一个页面&#xff0c;点击就可打开该tab&#xff0c;非常方便。 2、Momentum&#x…...

    2023/3/26 18:39:18
  6. 劳动争议案件是不是一定要用普通程序

    一、劳动争议案件是不是一定要用普通程序 法律没有规定劳动争议案件一定要用普通程序&#xff0c;劳动争议案件仲裁后&#xff0c;如果不服裁决&#xff0c;向法院起诉的&#xff0c;案情比较简单的&#xff0c;法院可以用简易程序审理。 《中华人民共和国民事诉讼法》 第一…...

    2023/3/26 18:36:37
  7. 读 Linux 像读小说「GitHub 热点速览 v.22.03」

    本周特推选取了一个画风有点意思的 Linux 代码带读项目 flash-linux0.11-talk,希望有趣的文风能带你读完 Linux 代码。当然画风可以增加阅读体验,彩色标记也是一种学习方法——annotated_latex_equations 手把手教你学各种各样彩色的公式注释,那色彩就像是 GitHub 移动端新支…...

    2023/3/26 17:47:11
  8. Mysql集群架构

    1. 集群架构设计 1.1 架构设计理念 主要从三个维度考虑问题&#xff1a; 可用性扩展性一致性 1.2 可用性设计 站点高可用&#xff0c;冗余站点服务高可用&#xff0c;冗余服务数据高可用&#xff0c;冗余数据 保证高可用的方法是冗余。 但是数据冗余带来的问题是数据一致性…...

    2023/3/26 17:05:09
  9. mysql使用二进制安装报错:error: rpmdb: BDB0113 Thread/process 13162/139635734849600 failed: BDB1507 Thread die

    本文主要遇到的问题&#xff0c;使用二进制命令报错yum -y install mysql-community-server安装mysql报错,报错如下&#xff1a; [rootoldboy soft]# yum -y install mysql-community-server error: rpmdb: BDB0113 Thread/process 13162/139635734849600 failed: BDB1507 Thr…...

    2023/3/26 16:58:10
  10. python 工业软件开发_记一次工业软件开发经历

    项目概述项目背景&#xff1a;工厂表面处理产线项目b司接了a司一条表面处理产线的项目&#xff0c;包含硬件及软件&#xff0c;由于现在b司做的软件难用且数据难以查找&#xff0c;a司不满意验收不通过&#xff0c;款项没有结清。所有b司找到我们,希望我们能帮他搞定这个软件系…...

    2023/3/26 16:55:16
  11. 10分钟教你写出 坦克大战【无敌版】

    导读 最近读到一位大佬的游戏文章之后&#xff0c;手痒难耐就想自己也写一个小游戏。苦于没有游戏素材在网上搜也都是付费的&#xff0c;我就随便写了一点点来给自己解解馋。&#x1f617; 好了废话不多说我们现在先试一下游戏效果。不好玩也不要说出来&#xff0c;嘻嘻嘻。后…...

    2023/3/26 16:49:20
  12. js 日期增加加天数计算

    //日期加天数计算 date&#xff1a;时间戳, days:天数 默认1天 function AddDate(date, days) {if (!days) {days 1;}var date new Date(date);date.setDate(date.getDate() days);return date; }...

    2023/3/26 15:54:07
  13. 惊呆了!这个视频压缩工具太强大了叭!!一键压制降维打击,体积小、无损画质!

    上链接 旧版-传送门1-够用了 新版-传送门2-没必要-钥匙&#xff1a;提取码&#xff1a;74l8 使用方法 打开即食 界面长这样 其余的默认即可&#xff0c;你又不是专业的&#xff0c;我也不是&#xff0c;听话&#xff01; 最多调一下CRF值&#xff0c;这个值&#xff0c;越…...

    2023/3/26 15:53:05
  14. mysql bdb_深入理解mysql之BDB系列(2)---数据元页结构(摘自老杨)

    三&#xff1a;数据元页结构3.1 metepage头结构该结构是一个公共结构。用于B树matapage页、HASH的matepage页以及queue的metapage。typedef struct _dbmeta33 {DB_LSN lsn; //LSNdb_pgno_t pgno; //当前页号u_int32_t magic; //调试用的魔数u_int32_t version; //数据库的当前版…...

    2023/3/26 15:42:01
  15. 实习、校招面试的一点经验

    最近学校的应届生、准应届生都开始准备着找&#xff08;实习&#xff09;工作&#xff0c;我的辅导员旭哥希望我能够给学习学妹们分享一下找工作相关的内容&#xff0c;我只好厚着脸皮分享一下我对面试的一点看法^^ 我把面试分成三个过程&#xff08;面前、面中、面后&#xf…...

    2023/3/26 15:38:32
  16. ​1970年代-大规模集成芯片(LSI)、ASIC和电子游戏吃豆人的诞生

    1970年代发展迅速的十年&#xff0c;BASIC和C高级编程语言在这十年中被广泛采用&#xff0c;大规模集成芯片&#xff08;LSI&#xff09;、ASIC等也被广泛应用到电子游戏中&#xff0c;同时经典游戏《吃豆人》和《星际迷航》也在这个时期诞生的&#xff0c;接下来让我们看看这十…...

    2023/3/26 15:37:01
  17. 数据科学中的陷阱:定性变量的处理

    定性变量&#xff0c;也就是表示类别的变量&#xff0c;比如性别、省份等。对于这类变量&#xff0c;不能在模型里直接使用它们&#xff0c;因为定性变量之间的数学计算是毫无意义的。另一方面&#xff0c;定性变量是一类很常见的变量&#xff0c;通常带着很有价值的信息。因此…...

    2023/3/26 15:31:03
  18. 专业视频压制神器下载——解决会声会影、PR、AE处理视频后过大的问题(三款工具)专业视频压制软件

    文章目录1. 按2. 工具下载3. 使用说明3.1. 小丸子工具箱1. 按 会声会影、PR、AE处理视频后文件过大怎么办&#xff1f;专业视频压制软件 第一种方法就是用格式工厂再处理一下会声会影&#xff08;PR、AE&#xff09;的输出文件&#xff0c;第二种用狸窝&#xff08;不过这款软…...

    2023/3/26 15:28:48
  19. 60岁代码匠的几篇小作文,解决了大多数程序的迷茫(上)

    陈德伟 | 译 不熟悉计算机底层原理&#xff0c;我能走多远&#xff1f;30 了&#xff0c;会被裁吧&#xff1f;到底学哪门编程语言更有前&#xff08;钱&#xff09;途&#xff1f; …… 裁员大潮&#xff0c;行业高度内卷带来的焦虑迫使我们总是重复面对以上问题&#xff0c;它…...

    2023/3/26 15:23:47
  20. 无人机在道路桥梁病害检测中的应用

    一种基于无人机的道路桥梁病害检测系统&#xff0c;分别对无人机软硬件系统进行了相应开发&#xff0c;形成了具有自主知识产权的无人机自动避障系统、病害识别系统和路桥巡检管理系统等&#xff0c;实现了对路桥病害等目标信息的高精度提取和变化检测。与传统路桥病害检测相比…...

    2023/3/26 15:23:43

最新文章

  1. Android文件操作工具类,拿去用吧!

    五一放假了&#xff0c;作为一个外地狗&#xff0c;就别想回家了&#xff0c;还是在学校搞点东西吧&#xff01;花了一天的时间&#xff0c;写了一个比较完善的文件管理工具类&#xff0c;希望小伙伴们能用上&#xff0c;有关于文件的常见操作&#xff0c;&#xff0c;一个我们…...

    2023/3/26 19:26:46
  2. 汇编语言全梳理(精简版)

    寄存器一览 通用寄存器 ax&#xff0c;bx&#xff0c;cx&#xff0c;dx&#xff0c;&#xff08;ah&#xff0c;al&#xff0c;bh&#xff0c;bl&#xff0c;ch&#xff0c;cl&#xff0c;dh&#xff0c;dl&#xff09;sp&#xff0c;bp&#xff0c;si&#xff0c;di 指令寄存…...

    2023/3/26 19:26:34
  3. 社交电商平台的消费返利模式——共享购

    实际上目前很多商家平台提到做电商平台&#xff0c;坚信最先第一个想到的是一些大型好像淘宝、某猫、某多多这些&#xff0c;但是随着社交媒体电商行业发展&#xff0c;大量商业运营模式及其商业平台&#xff0c;第一个的自然也就相对于交易返利模式的渠道&#xff0c;那大家在…...

    2023/3/26 19:26:30
  4. 威尔逊定理

    威尔逊定理&#xff08;Wilson定理&#xff09; 威尔逊定理&#xff08;Wilson定理&#xff09;&#xff1a; 如果ppp是一个质数&#xff0c;则 (p−1)!≡−1(modp)\left(p - 1\right)! \equiv -1 \left(\mathop{mod} p\right) (p−1)!≡−1(modp) 引理1 a2≡1(modp)a^2 \equ…...

    2023/3/26 19:26:25
  5. 27. 移除元素 26. 删除有序数组中的重复项 88. 合并两个有序数组(双指针遍历)

    目录[27. 移除元素-力扣](https://leetcode.cn/problems/remove-element/description/?languageTagsc)[26. 删除有序数组中的重复项](https://leetcode.cn/problems/remove-duplicates-from-sorted-array/)[88. 合并两个有序数组](https://leetcode.cn/problems/merge-sorted-…...

    2023/3/26 19:26:01
  6. LInkedList的模拟实现

    在之前的文章笔者介绍了链表的实现&#xff1a;无头单向非循环链表的实现&#xff01;感兴趣的各位老铁可以点进来看看&#xff1a;https://blog.csdn.net/weixin_64308540/article/details/128397961?spm1001.2014.3001.5502对于此篇博客&#xff0c;在一写出来&#xff0c;便…...

    2023/3/26 19:25:58
  7. Python循环部分学习总结

    一、循环流程展示图&#xff1a; 以上是循环的一个简略图。 二、循环的类型 Python 提供了 for 循环和 while 循环&#xff08;在 Python 中没有 do…while 循环&#xff09; 1.while循环&#xff1a; 在给定的判断条件为 true 时执行循环体&#xff0c;否则退出循环体。 2.f…...

    2023/3/26 19:25:57
  8. vim光速开发,你值得拥有

    文章目录vim设计哲学vim的模式什么是可视模式光标移动动作(motion)操作符(operator)操作符&#xff08;operator&#xff09;动作&#xff08;motion&#xff09;实际使用大小写转换easymotionvim-surroundTIPSideavim的使用vim设计哲学 vim被称为编辑器之神。它的成名就是因为…...

    2023/3/26 19:25:50
  9. 关于分布式的一些基础知识

    1、分布式锁 (ngix,zoomkeeper,raft,kafka) 在单机场景下&#xff0c;可以使用语言的内置锁来实现进程或者线程同步。但是在分布式场景下&#xff0c;需要同步的进程可能位于不同的节点上&#xff0c;那么就需要使用分布式锁。 为了保证一个方法或属性在高并发情况下的同一时间…...

    2023/3/26 19:25:38
  10. GPU服务器Ubuntu环境配置教程及各种踩坑

    博主的GPU服务器快要过期了&#xff0c;为了让其发挥更多的光和热&#xff0c;博主打算将系统重装&#xff0c;来分别感受下不同系统下的GPU服务器。哈哈哈 博主为了快速运行项目&#xff0c;在购买服务器时选择的是Pytorch 1.9.1 Ubuntu 18.04 &#xff0c;该系统下会帮我们安…...

    2023/3/26 19:25:35
  11. Python-TCP网络编程基础以及客户端程序开发

    文章目录一. 网络编程基础- 什么是IP地址?- 什么是端口和端口号?- TCP介绍- socket介绍二. TCP客户端程序开发三. 扩展一. 网络编程基础 - 什么是IP地址? IP地址就是标识网络中设备的一个地址 IP地址分为 IPv4 和 IPv6 IPv4使用十进制, IPv6使用十六进制 查看本机IP地址: l…...

    2023/3/26 19:25:10
  12. Socket简单学习之UDP通信

    UDP不可靠通信&#xff0c;不建立连接&#xff0c;只发送一次数据&#xff0c;不管对方是否接收服务器端using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using System.Net; using System.Text; using System.Threading.Tasks;…...

    2023/3/26 19:25:08
  13. 【软件分析第12讲-学习笔记】可满足性模理论 Satisfiability Modulo Theories

    文章目录前言正文从SAT到SMTSMT历史z3求解器SMT求解命题逻辑、一阶逻辑和二阶逻辑小结参考文献前言 创作开始时间&#xff1a;2022年11月16日16:18:59 如题&#xff0c;学习一下可满足性模理论 Satisfiability Modulo Theories的相关知识。参考&#xff1a;熊英飞老师2018《软…...

    2023/3/26 19:25:05
  14. 编程中常用的变量命名缩写查询表

    原文链接&#xff1a;https://blog.csdn.net/qq_37851620/article/details/94731227 全称缩写翻译calculatecalc计算additionadd加subtractionsub减multiplicationmul乘法divisiondiv除法hexadecimalhex十六进制全称缩写翻译arrayarr数组、集合listlst列表SequenceseqSegment(…...

    2023/3/26 19:24:57
  15. USBIP

    USBIP USB/IP 是一个开源项目&#xff0c;已合入 Kernel&#xff0c;在 Linux 环境下可以通过使用 USB/IP 远程共享 USB 设备。 USB Client&#xff1a;使用USB的终端&#xff0c;将server共享的usb设备挂载到本地。 USB Server&#xff1a;分享本地的usb设备至远程。 USBIP…...

    2023/3/26 19:24:54
  16. 如何快速提升教育直播间人气

    直播已经成为当下各企业标配的销售方式&#xff0c;对于教育企业也是如此&#xff0c;但要想把直播做好&#xff0c;最重要一点就是提升直播间人气&#xff0c;人气越高&#xff1a;直播间的互动就越频繁&#xff0c;氛围就越好&#xff0c;也能为品牌带来更多新粉&#xff0c;…...

    2023/3/26 19:24:27
  17. Elasticsearch处理表关联关系的N种方式

    Elasticsearch处理表关联关系是比较复杂的问题&#xff0c;处理不好会出现性能问题、数据一致性问题等&#xff1b; 今天我们特意分享一下几种方式&#xff0c;对象类型&#xff08;宽表&#xff09;、嵌套类型、父子关联关系、应用端关联&#xff0c;每种方式都有特定的业务需…...

    2023/3/26 19:24:00
  18. 【C++】简述STL——string类的使用

    文章目录一、STL的简述1.STL的框架2.STL版本二、编码铺垫三、string类四、常见构造五、operator[]六、访问及遍历七、iterator迭代器1.正向迭代器2.反向迭代器3.const迭代器八、Capacity容量操作1.常用接口2.扩容问题九、Modifiers修改操作十、非成员函数重载十一、总结一、STL…...

    2023/3/26 19:23:49
  19. 毕业设计-基于机器视觉的银行卡号识别系统

    目录 前言 课题背景和意义 实现技术思路 实现效果图样例 前言 &#x1f4c5;大四是整个大学期间最忙碌的时光,一边要忙着备考或实习为毕业后面临的就业升学做准备,一边要为毕业设计耗费大量精力。近几年各个学校要求的毕设项目越来越难,有不少课题是研究生级别难度的,对本科…...

    2023/3/26 19:23:42
  20. java架构百度云视频_史上最牛44套Java架构师视频教程合集

    视频课程包含&#xff1a;44套包含&#xff1a;架构师&#xff0c;高级课&#xff0c;微服务&#xff0c;微信支付宝支付&#xff0c;公众号开发&#xff0c;jA危a8新特忄生&#xff0c;P2P金融项目&#xff0c;程序设计&#xff0c;功能设计&#xff0c;数据库设计&#xff0c…...

    2023/3/26 19:23:39