RandomeAccessFile - read write
2024-08-28 17:10:02
RandomeAccessFile
use write replace writeBytes
public class RandomAccessFileTest {
public static void main(String[] args) {
try {
RandomAccessFile file= new RandomAccessFile("c://temp//in.txt","rw");
System.out.println(file.readLine()); file.seek(file.length());
//clear all
// file.setLength(0l); //use write() to replace writeBytes
file.write("hello ross test".getBytes());
//writeBytes will has issue on UTF8
// file.writeBytes("");
file.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
最新文章
- Python之路【第六篇】python基础 之面向对象(一)
- Xcode 7免证书真机调试
- dotNet下的一套解决方案
- Spirng中Mongodb中write-concern的解释
- iscroll性能
- Best Cow Fences_二分&;&;DP
- 2013ACM/ICPC亚洲区南京站现场赛——题目重现
- Kali vmtools
- codeforces 653D D. Delivery Bears(二分+网络流)
- 原生js的兼容问题总结
- linux ptrace I
- 基于visual Studio2013解决面试题之0409判断一个栈是否另外一个栈的弹出序列
- 自动生成数学题型三 (框架Struts2)题型如 a+b=c(a、b、c都为分数)
- 使用Google Cloud Platform构建机器学习项目-宠物识别
- 我的 FPGA 学习历程(11)—— 实验:按键消抖
- Python PEP8 编码规范
- 使用TensorFlow训练模型的基本流程【转】
- springdata笔记2
- JavaSE学习总结(十)—— JDBC与面向对象测试
- springmvc概述及框架原理
热门文章
- HTTP - 请求头的具体含义
- [译]14-spring 集合元素的注入
- Oracle 遇到的问题:IMP-00041: 警告: 创建的对象带有编译警告解决办法
- HDU 4667 Building Fence 计算几何 凸包+圆
- 蓝桥杯_风险度量_dfs_无向图两节点间的所有路径
- Android记事本开发04
- 【bzoj4756】[Usaco2017 Jan]Promotion Counting 离散化+树状数组
- 【bzoj4884】[Lydsy2017年5月月赛]太空猫 dp
- Python列表及元组操作
- hdu 2579 Dating with girls(2) (bfs)