//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
// package com.company; import java.io.File;
import java.io.IOException;
import java.util.Collection;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.apache.commons.io.DirectoryWalker;
import org.apache.commons.io.FileUtils; public class Utf8BomRemover extends DirectoryWalker {
private String extension = null;
private JFrame jFrame;
private int count; public Utf8BomRemover(JFrame controller, String extension) {
this.extension = extension;
this.jFrame = this.jFrame;
this.count = 0;
} public void start(File rootDir) throws IOException {
this.walk(rootDir, (Collection)null);
} protected void handleFile(File file, int depth, Collection results) throws IOException {
this.remove(file);
++this.count;
} protected void handleEnd(Collection results) throws IOException {
JOptionPane.showMessageDialog(this.jFrame, "你成功修改" + this.count + "个.java编码的BOM文件");
} private void remove(File file) throws IOException {
byte[] bs = FileUtils.readFileToByteArray(file);
if (bs[0] == -17 && bs[1] == -69 && bs[2] == -65) {
byte[] nbs = new byte[bs.length - 3];
System.arraycopy(bs, 3, nbs, 0, nbs.length);
FileUtils.writeByteArrayToFile(file, nbs);
} }
}
if(contents.length > 2 && (contents[0]&0xFF) == 0xEF && (contents[1] & 0xFF) == 0xBB && (contents[2] & 0xFF) == 0xBF) {
byte[] trim = new byte[contents.length - 3];
System.arraycopy(contents, 3, trim, 0, trim.length);
return trim;
}

Utf8BomRemover的更多相关文章

  1. java 清除 bom

    参考工具  http://akini.mbnet.fi/java/unicodereader/ Utf8BomRemover 清除bom的方法 package cn.com.do1.component ...

随机推荐

  1. Spring Boot2(002):手动创建第1个SpringBoot2简单应用——“HelloWorld” web 工程

    备注:以下内容参考 springboot 官方文档 https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/pdf/spring ...

  2. eclipse导入maven工程,右键没有build path和工程不能自动编译解决方法

    原文链接:https://blog.csdn.net/wusunshine/article/details/52506389 eclipse导入maven工程,右键没有build path解决方法: ...

  3. 对input type=file 修改样式

    效果图先给: 在html中涉及到文件选择的问题,文件选择使用 input(class="filter_input form-control" type="file) 但是 ...

  4. 实验吧Web-难-貌似有点难(http头欺骗)

    有关一些http头,参考:https://blog.csdn.net/zz_Caleb/article/details/84147066 打开链接:点击view source看到一段代码 <?p ...

  5. vue移动端点击一个元素缩小,松手的时候元素恢复正常

    active伪类解决 HTML代码 <div class='box'> </div> CSS代码 .box { width: 100px; height: 100px; bac ...

  6. SQL基础之JDBC、连接池

    JDBC JDBC四个核心对象 这几个类都是在java.sql包中 DriverManager(类): 数据库驱动管理类.这个类的作用:1)注册驱动; 2)创建java代码和数据库之间的连接,即获取C ...

  7. h5-transform二维变换-盾牌还原案例

    就是8张盾牌的拼图 1 <div class="transforms"> <img src="../img/dp1.png" alt=&quo ...

  8. CTF -攻防世界-web高手区-mfw

    ---恢复内容开始--- 昂,我很菜这是网上大神的教程. https://blog.csdn.net/silence1_/article/details/89741733 ---恢复内容结束---

  9. 如何编译生成 mkfs.ubifs、ubinize 工具

    参考文档: 1.<CoM335X linux开发指南.pdf>的附件1 2.ubifs的制作,移植的重点详解(使用交叉编译器) 3.UBIFS文件系统简介 与 利用mkfs.ubifs和u ...

  10. 新浪SAE云平台下使用codeigniter的数据库配置

    新浪SAE云平台下使用codeigniter的数据库配置 投稿:shichen2014 字体:[增加 减小] 类型:转载 这篇文章主要介绍了新浪SAE云平台下使用codeigniter的数据库配置,主 ...