<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-beta-1</version> <configuration> <warName>admingift</warName> <webRe…
修改了线上程序的xml配置文件,重启后报如下错误: MalformedByteSequenceException: Invalid byte 1 of 1-byte 百度了下大体的意思是说文件的编码错误,需要重新设置一下文件的编码格式. vim打开配置文件,执行命令: :set encoding=utf- 保存的时候又报错: 写入错误,转换失败 (请将 'fenc' 置空以强制执行) 执行: :set fenc= 重新保存,重启程序后恢复正常. fenc代表当前文件的编码格式,提示转换失败,也就…
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte 分类: Web Services 2011-08-17 22:04 11022人阅读 评论(3) 收藏 举报 bytexmlencoding com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Inva…
在网络编程中,出于节约带宽或者编码的需要,通常需要以原生方式处理long和int,而不是转换为string. public class ByteOrderUtils { public static byte[] int2byte(int res) { byte[] targets = new byte[4]; targets[3] = (byte) (res & 0xff);// 最低位 targets[2] = (byte) ((res >> 8) & 0xff);// 次低…
原文网址:http://freewind886.blog.163.com/blog/static/661924642011810236100/ 最近在做些与编解码相关的事情,又遇到了byte和int的转换,看着那些关于反码.补码的说明依旧头疼,还是记下些实用的方法吧.int -> byte可以直接使用强制类型转换: byte b = (byte) aInt;这个操作是直接截取int中最低一个字节,如果int大于255,则值就会变得面目全非了.对于通过InputStream.read()获取的in…
public static void copyInputStreamT0OutputStream(InputStream in, OutputStream out) { byte[] buffer = new byte[1024]; if (null != in) { try {      while (true) {      int len = 0;      if ((len = in.read(buffer)) == -1) {                out.flush(); …
转载于:http://yyzjava.iteye.com/blog/1178525 要搞清楚read(byte[] b)和readFully(byte[] b)的区别,可以从以下方面着手分析: 1.代码的具体实现 2.方法何时返回 3.字节是以什么方式在网络上传输的 1.read(byte[] b)调用read(byte[] b,0,b.length),其中的部分关键代码如下 int c = read();//读取字节流中的下一个字节 if (c == -1) { return -1; } b[…
添加了XML实体和表映射文件后,莫名报错,百思不得其解,也找不到哪里错了,后来把mybatis-config.xml文件中去掉中文注释就好了 mybatis-config.xml文件中的内容如下,去掉里面的<!-- 品牌 -->注释就好了 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Conf…
public static byte[] loadRawDataFromURL(String u) throws Exception { URL url = new URL(u); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is…
OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "(*.mp4)|*.mp4|(*.*)|*.*"; ofd.RestoreDirectory = true; if (ofd.ShowDialog() == DialogResult.OK) { try { // 打开文件 FileStream fileStream = new FileStream(ofd.FileName, FileMode.Open, FileAcce…