指令系統是指計算機所能執行的全部指令的集合,它描述了計算機內全部的控制信息和“邏輯判斷”能力。不同計算機的指令系統包含的指令種類和數目也不同。一般均包含算術運算型、邏輯運算型、數據傳送型、判定和控制型、移位操作型、位(位串)操作型、輸入和輸出型等指令。指令系統是表征一台計算機性能的重要因素,它的格式與功能不僅直接影響到機器的硬件結構,而且也直接影響到系統軟件,影響到機器的適用范圍。
一條指令就是機器語言的一個語句,它是一組有意義的二進制代碼,指令的基本格式如:操作碼字段+地址碼字段,其中操作碼指明了指令的操作性質及功能,地址碼則給出了操作數或操作數的地址。
1 package Com.TableText; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileNotFoundException; 6 import java.io.FileOutputStream; 7 import java.io.IOException; 8 import java.io.InputStream; 9 import java.io.OutputStream; 10 import java.text.DateFormat; 11 import java.util.Date; 12 13 public class TableText_01 { 14 /** 15 * 功能描述:列出某文件夾及其子文件夾下面的文件,並可根據擴展名過濾 16 * @param path 17 * 文件夾 18 */ 19 public static void list(File path) { 20 if (!path.exists()) { 21 System.out.println("文件名稱不存在!"); 22 } else { 23 if (path.isFile()) { 24 if (path.getName().toLowerCase().endsWith(".pdf") 25 || path.getName().toLowerCase().endsWith(".doc") 26 || path.getName().toLowerCase().endsWith(".chm") 27 || path.getName().toLowerCase().endsWith(".html") 28 || path.getName().toLowerCase().endsWith(".htm")) {// 文件格式 29 System.out.println(path); 30 System.out.println(path.getName()); 31 } 32 } else { 33 File[] files = path.listFiles(); 34 for (int i = 0; i < files.length; i++) { 35 list(files[i]); 36 } 37 } 38 } 39 } 40 41 /** 42 * 功能描述:拷貝一個目錄或者文件到指定路徑下,即把源文件拷貝到目標文件路徑下 43 * 44 * @param source 45 * 源文件 46 * @param target 47 * 目標文件路徑 48 * @return void 49 */ 50 public static void copy(File source, File target) { 51 52 File tarpath = new File(target, source.getName()); 53 if (source.isDirectory()) { 54 tarpath.mkdir(); 55 File[] dir = source.listFiles(); 56 for (int i = 0; i < dir.length; i++) { 57 copy(dir[i], tarpath); 58 } 59 } else { 60 try { 61 InputStream is = new FileInputStream(source); // 用於讀取文件的原始字節流 62 OutputStream os = new FileOutputStream(tarpath); // 用於寫入文件的原始字節的流 63 byte[] buf = new byte[1024];// 存儲讀取數據的緩沖區大小 64 int len = 0; 65 while ((len = is.read(buf)) != -1) { 66 os.write(buf, 0, len); 67 } 68 is.close(); 69 os.close(); 70 } catch (FileNotFoundException e) { 71 e.printStackTrace(); 72 } catch (IOException e) { 73 e.printStackTrace(); 74 } 75 } 76 } 77 78 /** 79 * @param args 80 */ 81 public static void main(String[] args) { 82 // TODO Auto-generated method stub 83 File file = new File("H://JavaFiles/ch.doc"); 84 File file2 = new File("H://"); 85 list(file); 86 copy(file,file2); 87 Date myDate = new Date(); 88 DateFormat df = DateFormat.getDateInstance(); 89 System.out.println(df.format(myDate)); 90 } 91 92 }
