# l-and-io **Repository Path**: longyn/l-and-io ## Basic Information - **Project Name**: l-and-io - **Description**: 一个简单实用的io库 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-02-28 - **Last Updated**: 2025-07-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: IO ## README # l-and-io #### 介绍 把每个文件夹抽象成一个 实列对象,方便文件文件读写操作 一个io库 #### 集成项目 添加仓库地址 ``` maven { url 'https://packages.aliyun.com/maven/repository/2386483-release-mhUqVd' credentials { username = "6166b8fa89e1d5005a9f5792" password = "W49P9mYH7aoH" } } ``` 添加依赖 ``` implementation 'com.lyn:io:1.1.2' ``` #### 使用说明 1. 文件夹操作工厂 ``` //创建Folder文件夹 test 抽象工厂 FolderFactory.create("test",filesDir.absolutePath) //获取test文件夹抽象对象 val folder = FolderFactory.get("test") //创建hello.txt 文件并写入 "写入内容" folder?.writeFile("hello.txt","写入内容",false) //支持写入bitmap 和文件转bitmap读取,支持读取xls表格转List集合,或者List集合转xls表格文件,具体查看Folder 抽象接口 ``` 2. SharedPreferences 封装使用 ``` //编写定义SpKey 单例类,便于管理定义键值 object SpKey { @SpString(defaultValue = "hello", "测试") const val TEST: String = "test21412" } //传入mmkv使用,不走原生SharedPreferences(推荐) SpFactory.create(MMKV.defaultMMKV(),"my_sp",SpKey) //使用原生SharedPreferences SpFactory.create(context,"my_sp",SpKey) val sp = SpFactory.get("my_sp") sp?.setString(SpKey.TEST,"hello") sp?.setInt("test2",1) sp?.setLong("test3",2) sp?.setFloat("test4",3f) ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)