原文参考 

http://www.javacodegeeks.com/2014/10/apache-commons-io-tutorial.html 



  Apache Commons IO 包绝对是好东西,地址在http://commons.apache.org/proper/commons-io/,下面用例子分别介绍: 

  1)  工具类 

  2) 输入 

  3) 输出 

  4) filters过滤 

  5) Comparators 

  6) 文件监控 

  

   总的入口例子为:

  1. public class ApacheCommonsExampleMain {
  2. public static void main(String[] args) {
  3. UtilityExample.runExample();
  4. FileMonitorExample.runExample();
  5. FiltersExample.runExample();
  6. InputExample.runExample();
  7. OutputExample.runExample();
  8. ComparatorExample.runExample();
  9. }
  10. }

一  工具类包UtilityExample代码: 



    这个工具类包分如下几个主要工具类: 

     1) FilenameUtils:主要处理各种操作系统下对文件名的操作 

     2) FileUtils:处理文件的打开,移动,读取和判断文件是否存在 

    3) IOCASE:字符串的比较 

    4) FileSystemUtils:返回磁盘的空间大小

  1. import java.io.File;
  2. import java.io.IOException;
  3. import org.apache.commons.io.FileSystemUtils;
  4. import org.apache.commons.io.FileUtils;
  5. import org.apache.commons.io.FilenameUtils;
  6. import org.apache.commons.io.LineIterator;
  7. import org.apache.commons.io.IOCase;
  8. public final class UtilityExample {
  9. // We are using the file exampleTxt.txt in the folder ExampleFolder,
  10. // and we need to provide the full path to the Utility classes.
  11. private static final String EXAMPLE_TXT_PATH =
  12. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\exampleTxt.txt";
  13. private static final String PARENT_DIR =
  14. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample";
  15. public static void runExample() throws IOException {
  16. System.out.println("Utility Classes example...");
  17. // FilenameUtils
  18. System.out.println("Full path of exampleTxt: " +
  19. FilenameUtils.getFullPath(EXAMPLE_TXT_PATH));
  20. System.out.println("Full name of exampleTxt: " +
  21. FilenameUtils.getName(EXAMPLE_TXT_PATH));
  22. System.out.println("Extension of exampleTxt: " +
  23. FilenameUtils.getExtension(EXAMPLE_TXT_PATH));
  24. System.out.println("Base name of exampleTxt: " +
  25. FilenameUtils.getBaseName(EXAMPLE_TXT_PATH));
  26. // FileUtils
  27. // We can create a new File object using FileUtils.getFile(String)
  28. // and then use this object to get information from the file.
  29. File exampleFile = FileUtils.getFile(EXAMPLE_TXT_PATH);
  30. LineIterator iter = FileUtils.lineIterator(exampleFile);
  31. System.out.println("Contents of exampleTxt...");
  32. while (iter.hasNext()) {
  33. System.out.println("\t" + iter.next());
  34. }
  35. iter.close();
  36. // We can check if a file exists somewhere inside a certain directory.
  37. File parent = FileUtils.getFile(PARENT_DIR);
  38. System.out.println("Parent directory contains exampleTxt file: " +
  39. FileUtils.directoryContains(parent, exampleFile));
  40. // IOCase
  41. String str1 = "This is a new String.";
  42. String str2 = "This is another new String, yes!";
  43. System.out.println("Ends with string (case sensitive): " +
  44. IOCase.SENSITIVE.checkEndsWith(str1, "string."));
  45. System.out.println("Ends with string (case insensitive): " +
  46. IOCase.INSENSITIVE.checkEndsWith(str1, "string."));
  47. System.out.println("String equality: " +
  48. IOCase.SENSITIVE.checkEquals(str1, str2));
  49. // FileSystemUtils
  50. System.out.println("Free disk space (in KB): " + FileSystemUtils.freeSpaceKb("C:"));
  51. );
  52. }
  53. }

输出:

  1. Utility Classes example...
  2. Full path of exampleTxt: C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\
  3. Full name of exampleTxt: exampleTxt.txt
  4. Extension of exampleTxt: txt
  5. Base name of exampleTxt: exampleTxt
  6. Contents of exampleTxt...
  7. This is an example text file.
  8. We will use it for experimenting with Apache Commons IO.
  9. Parent directory contains exampleTxt file: true
  10. Ends with string (case sensitive): false
  11. Ends with string (case insensitive): true
  12. String equality: false

二  FileMonitor工具类包 

   这个org.apache.commons.io.monitor 包中的工具类可以监视文件或者目录的变化,获得指定文件或者目录的相关信息,下面看例子:

  1. import java.io.File;
  2. import java.io.IOException;
  3. import org.apache.commons.io.FileDeleteStrategy;
  4. import org.apache.commons.io.FileUtils;
  5. import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
  6. import org.apache.commons.io.monitor.FileAlterationMonitor;
  7. import org.apache.commons.io.monitor.FileAlterationObserver;
  8. import org.apache.commons.io.monitor.FileEntry;
  9. public final class FileMonitorExample {
  10. private static final String EXAMPLE_PATH =
  11. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\exampleFileEntry.txt";
  12. private static final String PARENT_DIR =
  13. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder";
  14. private static final String NEW_DIR =
  15. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\newDir";
  16. private static final String NEW_FILE =
  17. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\newFile.txt";
  18. public static void runExample() {
  19. System.out.println("File Monitor example...");
  20. // FileEntry
  21. // We can monitor changes and get information about files
  22. // using the methods of this class.
  23. FileEntry entry = new FileEntry(FileUtils.getFile(EXAMPLE_PATH));
  24. System.out.println("File monitored: " + entry.getFile());
  25. System.out.println("File name: " + entry.getName());
  26. System.out.println("Is the file a directory?: " + entry.isDirectory());
  27. // File Monitoring
  28. // Create a new observer for the folder and add a listener
  29. // that will handle the events in a specific directory and take action.
  30. File parentDir = FileUtils.getFile(PARENT_DIR);
  31. FileAlterationObserver observer = new FileAlterationObserver(parentDir);
  32. observer.addListener(new FileAlterationListenerAdaptor() {
  33. @Override
  34. public void onFileCreate(File file) {
  35. System.out.println("File created: " + file.getName());
  36. }
  37. @Override
  38. public void onFileDelete(File file) {
  39. System.out.println("File deleted: " + file.getName());
  40. }
  41. @Override
  42. public void onDirectoryCreate(File dir) {
  43. System.out.println("Directory created: " + dir.getName());
  44. }
  45. @Override
  46. public void onDirectoryDelete(File dir) {
  47. System.out.println("Directory deleted: " + dir.getName());
  48. }
  49. });
  50. // Add a monior that will check for events every x ms,
  51. // and attach all the different observers that we want.
  52. , observer);
  53. try {
  54. monitor.start();
  55. // After we attached the monitor, we can create some files and directories
  56. // and see what happens!
  57. File newDir = new File(NEW_DIR);
  58. File newFile = new File(NEW_FILE);
  59. newDir.mkdirs();
  60. newFile.createNewFile();
  61. );
  62. FileDeleteStrategy.NORMAL.delete(newDir);
  63. FileDeleteStrategy.NORMAL.delete(newFile);
  64. );
  65. monitor.stop();
  66. } catch (IOException e) {
  67. e.printStackTrace();
  68. } catch (InterruptedException e) {
  69. e.printStackTrace();
  70. } catch (Exception e) {
  71. e.printStackTrace();
  72. }
  73. }
  74. }

输出如下:

  1. File Monitor example...
  2. File monitored: C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\exampleFileEntry.txt
  3. File name: exampleFileEntry.txt
  4. Is the file a directory?: false
  5. Directory created: newDir
  6. File created: newFile.txt
  7. Directory deleted: newDir
  8. File deleted: newFile.txt

上面的特性的确很赞!分析下,这个工具类包下的工具类,可以允许我们创建跟踪文件或目录变化的监听句柄,当文件目录等发生任何变化,都可以用“观察者”的身份进行观察, 

其步骤如下: 

   1) 创建要监听的文件对象 

   2) 创建FileAlterationObserver 监听对象,在上面的例子中, 

   File parentDir = FileUtils.getFile(PARENT_DIR); 

  FileAlterationObserver observer = new FileAlterationObserver(parentDir); 

   创建的是监视parentDir目录的变化, 

   3) 为观察器创建FileAlterationListenerAdaptor的内部匿名类,增加对文件及目录的增加删除的监听 

   4) 创建FileAlterationMonitor监听类,每隔500ms监听目录下的变化,其中开启监视是用monitor的start方法即可。 



三  过滤器 filters 

   先看例子:

  1. import java.io.File;
  2. import org.apache.commons.io.FileUtils;
  3. import org.apache.commons.io.IOCase;
  4. import org.apache.commons.io.filefilter.AndFileFilter;
  5. import org.apache.commons.io.filefilter.NameFileFilter;
  6. import org.apache.commons.io.filefilter.NotFileFilter;
  7. import org.apache.commons.io.filefilter.OrFileFilter;
  8. import org.apache.commons.io.filefilter.PrefixFileFilter;
  9. import org.apache.commons.io.filefilter.SuffixFileFilter;
  10. import org.apache.commons.io.filefilter.WildcardFileFilter;
  11. public final class FiltersExample {
  12. private static final String PARENT_DIR =
  13. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder";
  14. public static void runExample() {
  15. System.out.println("File Filter example...");
  16. // NameFileFilter
  17. // Right now, in the parent directory we have 3 files:
  18. //      directory example
  19. //      file exampleEntry.txt
  20. //      file exampleTxt.txt
  21. // Get all the files in the specified directory
  22. // that are named "example".
  23. File dir = FileUtils.getFile(PARENT_DIR);
  24. String[] acceptedNames = {"example", "exampleTxt.txt"};
  25. for (String file: dir.list(new NameFileFilter(acceptedNames, IOCase.INSENSITIVE))) {
  26. System.out.println("File found, named: " + file);
  27. }
  28. //WildcardFileFilter
  29. // We can use wildcards in order to get less specific results
  30. //      ? used for 1 missing char
  31. //      * used for multiple missing chars
  32. for (String file: dir.list(new WildcardFileFilter("*ample*"))) {
  33. System.out.println("Wildcard file found, named: " + file);
  34. }
  35. // PrefixFileFilter
  36. // We can also use the equivalent of startsWith
  37. // for filtering files.
  38. for (String file: dir.list(new PrefixFileFilter("example"))) {
  39. System.out.println("Prefix file found, named: " + file);
  40. }
  41. // SuffixFileFilter
  42. // We can also use the equivalent of endsWith
  43. // for filtering files.
  44. for (String file: dir.list(new SuffixFileFilter(".txt"))) {
  45. System.out.println("Suffix file found, named: " + file);
  46. }
  47. // OrFileFilter
  48. // We can use some filters of filters.
  49. // in this case, we use a filter to apply a logical
  50. // or between our filters.
  51. for (String file: dir.list(new OrFileFilter(
  52. new WildcardFileFilter("*ample*"), new SuffixFileFilter(".txt")))) {
  53. System.out.println("Or file found, named: " + file);
  54. }
  55. // And this can become very detailed.
  56. // Eg, get all the files that have "ample" in their name
  57. // but they are not text files (so they have no ".txt" extension.
  58. for (String file: dir.list(new AndFileFilter( // we will match 2 filters...
  59. new WildcardFileFilter("*ample*"), // ...the 1st is a wildcard...
  60. new NotFileFilter(new SuffixFileFilter(".txt"))))) { // ...and the 2nd is NOT .txt.
  61. System.out.println("And/Not file found, named: " + file);
  62. }
  63. }
  64. }

可以看清晰看到,使用过滤器,可以分别在指定的目录下,寻找符合条件 

的文件,比如以什么开头的文件名,支持通配符,甚至支持多个过滤器进行或的操作! 

  输出如下:

  1. File Filter example...
  2. File found, named: example
  3. File found, named: exampleTxt.txt
  4. Wildcard file found, named: example
  5. Wildcard file found, named: exampleFileEntry.txt
  6. Wildcard file found, named: exampleTxt.txt
  7. Prefix file found, named: example
  8. Prefix file found, named: exampleFileEntry.txt
  9. Prefix file found, named: exampleTxt.txt
  10. Suffix file found, named: exampleFileEntry.txt
  11. Suffix file found, named: exampleTxt.txt
  12. Or file found, named: example
  13. Or file found, named: exampleFileEntry.txt
  14. Or file found, named: exampleTxt.txt
  15. And/Not file found, named: example

四  Comparators比较器 

   org.apache.commons.io.comparator包下的工具类,可以方便进行文件的比较:

  1. import java.io.File;
  2. import java.util.Date;
  3. import org.apache.commons.io.FileUtils;
  4. import org.apache.commons.io.IOCase;
  5. import org.apache.commons.io.comparator.LastModifiedFileComparator;
  6. import org.apache.commons.io.comparator.NameFileComparator;
  7. import org.apache.commons.io.comparator.SizeFileComparator;
  8. public final class ComparatorExample {
  9. private static final String PARENT_DIR =
  10. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder";
  11. private static final String FILE_1 =
  12. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\example";
  13. private static final String FILE_2 =
  14. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\ExampleFolder\\exampleTxt.txt";
  15. public static void runExample() {
  16. System.out.println("Comparator example...");
  17. //NameFileComparator
  18. // Let's get a directory as a File object
  19. // and sort all its files.
  20. File parentDir = FileUtils.getFile(PARENT_DIR);
  21. NameFileComparator comparator = new NameFileComparator(IOCase.SENSITIVE);
  22. File[] sortedFiles = comparator.sort(parentDir.listFiles());
  23. System.out.println("Sorted by name files in parent directory: ");
  24. for (File file: sortedFiles) {
  25. System.out.println("\t"+ file.getAbsolutePath());
  26. }
  27. // SizeFileComparator
  28. // We can compare files based on their size.
  29. // The boolean in the constructor is about the directories.
  30. //      true: directory's contents count to the size.
  31. //      false: directory is considered zero size.
  32. SizeFileComparator sizeComparator = new SizeFileComparator(true);
  33. File[] sizeFiles = sizeComparator.sort(parentDir.listFiles());
  34. System.out.println("Sorted by size files in parent directory: ");
  35. for (File file: sizeFiles) {
  36. System.out.println("\t"+ file.getName() + " with size (kb): " + file.length());
  37. }
  38. // LastModifiedFileComparator
  39. // We can use this class to find which file was more recently modified.
  40. LastModifiedFileComparator lastModified = new LastModifiedFileComparator();
  41. File[] lastModifiedFiles = lastModified.sort(parentDir.listFiles());
  42. System.out.println("Sorted by last modified files in parent directory: ");
  43. for (File file: lastModifiedFiles) {
  44. Date modified = new Date(file.lastModified());
  45. System.out.println("\t"+ file.getName() + " last modified on: " + modified);
  46. }
  47. // Or, we can also compare 2 specific files and find which one was last modified.
  48. //      returns > 0 if the first file was last modified.
  49. //      returns  0)
  50. System.out.println("File " + file1.getName() + " was modified last because...");
  51. else
  52. System.out.println("File " + file2.getName() + "was modified last because...");
  53. System.out.println("\t"+ file1.getName() + " last modified on: " +
  54. new Date(file1.lastModified()));
  55. System.out.println("\t"+ file2.getName() + " last modified on: " +
  56. new Date(file2.lastModified()));
  57. }
  58. }

输出如下:

  1. Comparator example...
  2. Sorted by name files in parent directory:
  3. C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\comparator1.txt
  4. C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\comperator2.txt
  5. C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\example
  6. C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\exampleFileEntry.txt
  7. C:\Users\Lilykos\workspace\ApacheCommonsExample\ExampleFolder\exampleTxt.txt
  8. Sorted by size files in parent directory:
  9. Sorted by last modified files in parent directory:
  10. 14:02:22 EET 2014
  11. 23:42:55 EET 2014
  12. 14:48:28 EET 2014
  13. 14:48:52 EET 2014
  14. 14:53:50 EET 2014
  15. File example was modified last because...
  16. 23:42:55 EET 2014
  17. 14:02:22 EET 2014

可以看到,在上面的代码中 

NameFileComparator: 文件名的比较器,可以进行文件名称排序; 

SizeFileComparator: 按照文件大小比较 

LastModifiedFileComparator: 根据最新修改日期比较 



五  input包 

    在 common io的org.apache.commons.io.input 包中,有各种对InputStream的实现类: 

我们看下其中的TeeInputStream, ,它接受InputStream和Outputstream参数,例子如下:

  1. import java.io.ByteArrayInputStream;
  2. import java.io.ByteArrayOutputStream;
  3. import java.io.File;
  4. import java.io.IOException;
  5. import org.apache.commons.io.FileUtils;
  6. import org.apache.commons.io.input.TeeInputStream;
  7. import org.apache.commons.io.input.XmlStreamReader;
  8. public final class InputExample {
  9. private static final String XML_PATH =
  10. "C:\\Users\\Lilykos\\workspace\\ApacheCommonsExample\\InputOutputExampleFolder\\web.xml";
  11. private static final String INPUT = "This should go to the output.";
  12. public static void runExample() {
  13. System.out.println("Input example...");
  14. XmlStreamReader xmlReader = null;
  15. TeeInputStream tee = null;
  16. try {
  17. // XmlStreamReader
  18. // We can read an xml file and get its encoding.
  19. File xml = FileUtils.getFile(XML_PATH);
  20. xmlReader = new XmlStreamReader(xml);
  21. System.out.println("XML encoding: " + xmlReader.getEncoding());
  22. // TeeInputStream
  23. // This very useful class copies an input stream to an output stream
  24. // and closes both using only one close() method (by defining the 3rd
  25. // constructor parameter as true).
  26. ByteArrayInputStream in = new ByteArrayInputStream(INPUT.getBytes("US-ASCII"));
  27. ByteArrayOutputStream out = new ByteArrayOutputStream();
  28. tee = new TeeInputStream(in, out, true);
  29. tee.read(new byte[INPUT.length()]);
  30. System.out.println("Output stream: " + out.toString());
  31. } catch (IOException e) {
  32. e.printStackTrace();
  33. } finally {
  34. try { xmlReader.close(); }
  35. catch (IOException e) { e.printStackTrace(); }
  36. try { tee.close(); }
  37. catch (IOException e) { e.printStackTrace(); }
  38. }
  39. }
  40. }

输出:

  1. Input example...
  2. Output stream: This should go to the output.

tee = new TeeInputStream(in, out, true); 

   中,分别三个参数,将输入流的内容输出到输出流,true参数为最后关闭流 

六 output工具类包 

  

  其中的org.apache.commons.io.output 是实现了outputstream,其中好特别的是 

TeeOutputStream能将一个输入流分别输出到两个输出流

  1. import java.io.ByteArrayInputStream;
  2. import java.io.ByteArrayOutputStream;
  3. import java.io.IOException;
  4. import org.apache.commons.io.input.TeeInputStream;
  5. import org.apache.commons.io.output.TeeOutputStream;
  6. public final class OutputExample {
  7. private static final String INPUT = "This should go to the output.";
  8. public static void runExample() {
  9. System.out.println("Output example...");
  10. TeeInputStream teeIn = null;
  11. TeeOutputStream teeOut = null;
  12. try {
  13. // TeeOutputStream
  14. ByteArrayInputStream in = new ByteArrayInputStream(INPUT.getBytes("US-ASCII"));
  15. ByteArrayOutputStream out1 = new ByteArrayOutputStream();
  16. ByteArrayOutputStream out2 = new ByteArrayOutputStream();
  17. teeOut = new TeeOutputStream(out1, out2);
  18. teeIn = new TeeInputStream(in, teeOut, true);
  19. teeIn.read(new byte[INPUT.length()]);
  20. System.out.println("Output stream 1: " + out1.toString());
  21. System.out.println("Output stream 2: " + out2.toString());
  22. } catch (IOException e) {
  23. e.printStackTrace();
  24. } finally {
  25. // No need to close teeOut. When teeIn closes, it will also close its
  26. // Output stream (which is teeOut), which will in turn close the 2
  27. // branches (out1, out2).
  28. try { teeIn.close(); }
  29. catch (IOException e) { e.printStackTrace(); }
  30. }
  31. }
  32. }

输出:

Java代码  
  1. Output example...
  2. : This should go to the output.
  3. : This should go to the output.

apache commons io入门的更多相关文章

  1. Apache Commons IO入门教程(转)

    Apache Commons IO是Apache基金会创建并维护的Java函数库.它提供了许多类使得开发者的常见任务变得简单,同时减少重复(boiler-plate)代码,这些代码可能遍布于每个独立的 ...

  2. [转]Apache Commons IO入门教程

    Apache Commons IO是Apache基金会创建并维护的Java函数库.它提供了许多类使得开发者的常见任务变得简单,同时减少重复(boiler-plate)代码,这些代码可能遍布于每个独立的 ...

  3. apache.commons.io.IOUtils: 一个很方便的IO工具库(比如InputStream转String)

    转换InputStream到String, 比如 //引入apache的io包 import org.apache.commons.io.IOUtils; ... ...String str = IO ...

  4. Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils

    1.错误叙述性说明 警告: Could not create JarEntryRevision for [jar:file:/D:/MyEclipse/apache-tomcat-7.0.53/web ...

  5. apache commons io包基本功能

    1. http://jackyrong.iteye.com/blog/2153812 2. http://www.javacodegeeks.com/2014/10/apache-commons-io ...

  6. java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream(转)

    java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream 使用Tomcat的Manag ...

  7. IO与文件读写---使用Apache commons IO包提高读写效率

    觉得很不错,就转载了, 作者: Paul Lin 首先贴一段Apache commons IO官网上的介绍,来对这个著名的开源包有一个基本的了解:Commons IO is a library of ...

  8. java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

    java.lang.ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream at org.apach ...

  9. Apache Commons IO之FileUtils的常用方法

    Apache Commons IO 在学习io流的时候研究(翻译)了一下这个,只有FileUtils的某些方法,并不全面,还请谅解 org.apache.commons.io 这个包下定义了基于 st ...

随机推荐

  1. ashx 下载文件

    ashx后台 byte[] file =GetFileByte(""); Response.ContentType = "application/octet-stream ...

  2. Sense编辑器(Sense Editor)

    Sense编辑器(Sense Editor) 学习了:https://blog.csdn.net/AbnerGong/article/details/50776605 Sense是一个方便的控制台,用 ...

  3. 转: windows下C++ UI库 UI神器-SOUI

    转:http://www.cnblogs.com/setoutsoft/p/4996870.html 前言 在Windows平台上开发客户端产品是一个非常痛苦的过程,特别是还要用C++的时候.尽管很多 ...

  4. Java补漏(一)

     第一章前言 在学长的建议下,为了弥补之前学Java漏下的或者不是非常清楚的知识点,买了本蛮好的教科书-<Java学习笔记(JDK6)>,正式又一次学习.为了记下一些让我恍然大悟的知识 ...

  5. HTML+JavaScript实现链式运动特效

    在学习js的过程中,发现这家伙做特效真是不错,尽管说眼下水平还不够,只是也能写点简单的效果. 今天分享一个简单的运动框架.然后利用这个框架实现简单的链式运动特效. 1.move.js 在运动框架中.主 ...

  6. CCPlatformConfig(设置执行平台 iOS android win32等。。。)

    #ifndef __CC_PLATFORM_CONFIG_H__ #define __CC_PLATFORM_CONFIG_H__ /** Config of cocos2d-x project, p ...

  7. php stripslashes和addslashes的区别

    我们在向mysql写入数据时,比如: mysql_query("update table set `title`='kuhanzhu's blog'"); 那就会出错.同asp时一 ...

  8. Visual Studio2015 简体中文版 安装

    VS2015简体中文版安装 导航 介绍 解决安装先决条件 安装 VS2015 创建桌面快捷方式 启动 VS2015 命令启动VS2015 配置 VS2015 启动完成 Visual Studio的功能 ...

  9. Git原始笔记

    .dir .mkdir lxit .cd lxit .git init(git仓库不要动!!! 除非用命令动它里面的文件,新添加的可以动) .ls .pwd Config: git config -- ...

  10. ionic中ionicView的生命周期

    ionicView的生命周期的事件调用在每个ionicView的controller中使用$scope.$on('$ionicView.enter', function() {});调用. 1.$ i ...