MxFormatRead.java
01 /*
02  * $Id: MxFormatRead.java,v 1.3 2008/01/12 01:54:55 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap14;
08 
09 import java.io.FileInputStream;
10 import java.io.IOException;
11 import java.io.InputStream;
12 
13 import org.mklab.nfc.matrix.Matrix;
14 import org.mklab.nfc.matx.MatxInteger;
15 import org.mklab.nfc.matx.MatxList;
16 import org.mklab.nfc.matx.MatxMatrix;
17 import org.mklab.nfc.matx.MatxString;
18 
19 
20 /**
21  * MaTXのMX形式としてデータを読み込むサンプルです。
22  @author koga
23  @version $Revision: 1.3 $, 2004/04/26
24  */
25 public class MxFormatRead {
26 
27   /**
28    * メインメソッド
29    
30    @param args コマンドライン引数
31    @throws IOException ファイルから読み込めない場合
32    */
33   @SuppressWarnings("nls")
34   public static void main(String[] argsthrows IOException {
35     InputStream input = new FileInputStream("data.mx");
36     int a = MatxInteger.readMxFormat(input);
37     String b = MatxString.readMxFormat(input).toString();
38     Matrix c = MatxMatrix.readMxFormat(input);
39     MatxList d = MatxList.readMxFormat(input);
40     input.close();
41 
42     System.out.println("a = " + a);
43     System.out.println("b = " + b);
44     c.print("c");
45     d.print("d");
46   }
47 }