`
JavaSam
  • 浏览: 952129 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
  /**序列化**/ import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.List; import nu.xom.Document; import nu.xom.Element; import nu.xom.Serializer; public class Person { private String first , last; ...
import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class Line { private static int color = 2;//此字段不能自动序列化 public static void serializaStaticState(ObjectOutputStream os) throws IOException { os.writeInt(color);//要想序列化必须加入特定的方法 ...

JAVA 压缩文件之GZIP

    博客分类:
  • JAVA
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutpu ...
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.RandomAccessFile; impo ...
import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; public class LargeMappedFiles { static int length = 0x8FFFFFF;//128M public static void main(String[] args) { t ...
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class ChannelCopy { private static final int BSIZE =1024; public static void mai ...
  import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import org.apache.tools.zip.ZipEntry; import org.apache.tools.zip.ZipFile; import org.apache.tools.zip.ZipOutputStre ...
  import java.io.IOException; import java.io.*; import java.net.URL; import java.net.URLConnection; //操作从URL中获取网络资源的类 public class Url { public static void getImageResourcByURL(String imagesFile) throws IOException {// 获取URL指定的资源 URL url = new URL(imagesFile); Object obj = url.get ...
  package com.file; import java.awt.BorderLayout; import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayLi ...
  package com.file; import java.awt.*; import java.applet.*; import java.util.*; //操作运用多线程实现一个钟表的类 public class TextClock extends Applet implements Runnable { Thread HOUR_THREAD = null;// 表示时针的线程 Thread MINUTE_THREAD = null;// 表示分针的线程 Thread SECOND_THREAD = null;// 表示秒针的线程 int hour_a, ...
package com.file; import java.util.*; import java.util.jar.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class OperatorJAR { // 操作JAR文件的类 public static void readJARList(String fileName) throws IOExc ...
  package com.file; import java.io.File; import java.io.IOException; import java.util.Scanner; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.format.UnderlineStyle; import jxl.write.DateFormat; import jxl.write.DateTime; import jxl.write.Label; import jxl.write.Numb ...

JAVA 锁定文件

    博客分类:
  • JAVA
package com.file; import java.io.FileOutputStream; import java.nio.channels.FileLock; //操作文件锁定的类 public class LockFile { public static void fileLock(String file) {// 锁定文件 FileOutputStream fous = null; FileLock lock = null; try { fous = new FileOutputStream(file);// 创建文件输出流 ...
package com.file; import java.io.File; import java.io.IOException; //创建新文件和目录 public class CCRDFile { // 验证字符串是否为正确路径名的正则表达式 private static String matches = "[A-Za-z]:\\\\[^:?\"><*]*"; // 通过 sPath.matches(matches) 方法的返回值判断是否正确 // sPath 为路径字符串 boolean flag = fals ...
package com.file; import java.io.File;//引入类 import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; //实现文件的简单处理,复制和移动文件、目录等 public class TextCopyFileAndMove { public static void fil ...
Global site tag (gtag.js) - Google Analytics