
io
car-java
这个作者很懒,什么都没留下…
展开
-
IO示例练习
java流api使用原创 2022-11-19 21:11:14 · 388 阅读 · 0 评论 -
读取中文内容编码
public static String code(String name) throws IOException{ InputStream is = new FileInputStream(name); byte[] b = new byte[3]; is.read(b); String code = "GBK"; if (b[0] == -17 && b[1] == -69 && b...原创 2022-03-06 11:56:36 · 153 阅读 · 0 评论 -
文件工具类
public void moveFile(String path, String _path) { File file = new File(path); if (file.isDirectory()) { File[] files = file.listFiles((dir, name) -> { File f = new File(dir, name); return f...原创 2021-05-29 07:32:37 · 136 阅读 · 0 评论 -
File类的renameTo的神奇之处
该方法是可以重命名和移动文件。他还以边重命名,边移动的指定目录下。比如我移动A目录下的一个文件A1,移动到B目录下,同时改名B1File f=new File(dir,name)File $f = new File(dir1,name);File _f = new File(dir2, name);f.renameTo(_f)...原创 2021-01-03 21:28:15 · 234 阅读 · 0 评论 -
求出一个目录下的文件不存在于另一个目录下的文件
public static void diffFile(String srcPath, String targetPath) { File $file = new File(srcPath); File _file = new File(targetPath); File[] $files = $file.listFiles((dir, name) -> { File f = new File(dir.getPath(), n..原创 2020-12-12 21:07:53 · 110 阅读 · 0 评论 -
MultipartFil e单元测试使用
private void upload(String pathname,String first) throws IOException { File file=new File(pathname); FileItem fileItem = new DiskFileItem(null, Files.probeContentType(file.toPath()), false, file.getName(), (int) file.length(), file.getParentFile());.原创 2020-09-08 10:53:53 · 503 阅读 · 0 评论 -
java解析dom元素
public void copyNetFile() throws IOException, URISyntaxException { String pathname="D:"+File.separator+"threadDumps"; File file=new File(pathname); File[] files = file.listFiles(new FileFilter() { @Override ...原创 2020-09-02 00:18:05 · 286 阅读 · 0 评论 -
python同步文件
import collectionsimport osimport reimport shutilimport sysdef file_sync(src_path,dest_path): if src_path==dest_path or not os.path.isdir(src_path) or not os.path.isdir(dest_path): return dir_pa=re.compile(r"target|.mvn|.git") fi..原创 2020-08-30 23:09:17 · 256 阅读 · 0 评论