利用java内存映射文件机制实现CRC循环冗余校验
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.zip.CRC32;
public static void main(String[] args){
try { //对
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.zip.CRC32;
public static void main(String[] args){
try { //对文件进行crc校验
long begin = System.currentTimeMillis();
FileInputStream in = new FileInputStream("code.py");//指定目标文件
FileChannel channel = in.getChannel(); //从文件中获取一个通道
CRC32 crc = new CRC32();
int length = (int)channel.size();
MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, length); //用只读模式从该通道获取字节缓冲,实现文件到内存的映射
for(int i = 0;i<length;i++)
 
相关文档:
单例模式.
简而言之,就是一个类只有一个实例。
Singleton.java:
package com.xfimti.sigleton;
public class Singleton
{
/*第一种方式。*/
private static Singleton singleton = new Singleton();
/*第二种方式。*/
private static Singleton mySingleton = null;
p ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
这几天一直在处理Java的日期问题,通常需要按要求生成日期的话,通常会用到util包中的Calendar类,再用Calendar的getTime()方法生成对应的Date,最后用SimpleDateFormat输出。
1. 获取当期日期、年份、月份
import java.util.Calendar;
public clas ......
计算机专业毕业两年了,终于找到学习的感觉了,后悔当时在学校时的无知和狂妄!!!
现在我对Java web编程有了兴趣,我写了自己的用户登录小程序,已经上传到我的CSDN空间了,欢迎大家来访问!!!
讨论之后,欢迎来信,共同提高!!!
联系方式:243093502@@qq.com ......