java/LangTable/src/cz/frantovo/langtable/LangTable.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 20 Nov 2016 18:22:56 +0100
changeset 39 988b56d4a7b8
parent 20 63b496ae04f9
permissions -rw-r--r--
libevent: identifikace serverových soketů a jednotlivých spojení (pomocí čísel FD)
     1 package cz.frantovo.langtable;
     2 
     3 import cz.frantovo.langtable.Keyboards.*;
     4 import java.io.File;
     5 import javax.xml.bind.JAXBContext;
     6 import javax.xml.bind.JAXBException;
     7 import javax.xml.bind.Unmarshaller;
     8 
     9 /**
    10  *
    11  * @author Ing. František Kučera (frantovo.cz)
    12  */
    13 public class LangTable {
    14 
    15 	/**
    16 	 * @param args the command line arguments
    17 	 */
    18 	public static void main(String[] args) throws JAXBException {
    19 
    20 
    21 		JAXBContext c = JAXBContext.newInstance(Keyboards.class);
    22 		Unmarshaller u = c.createUnmarshaller();
    23 		
    24 		long start = System.currentTimeMillis();
    25 		Object o = u.unmarshal(new File("data/keyboards.xml"));
    26 		System.out.println("Time: " + (System.currentTimeMillis() - start) + " ms");
    27 		
    28 		Keyboards keyboards = (Keyboards) o;
    29 
    30 		for (Keyboard k : keyboards.getKeyboards()) {
    31 			System.out.println(k.getId());
    32 			System.out.println("  " + k.getDescription());
    33 			System.out.println("  " + k.getComment());
    34 			System.out.println("  " + k.isAscii());
    35 
    36 			System.out.println("  languages: " + k.getLanguages().size());
    37 			for (Language l : k.getLanguages()) {
    38 				System.out.println("    " + l);
    39 			}
    40 
    41 			System.out.println("  territories: " + k.getTerritories().size());
    42 			for (Territory t : k.getTerritories()) {
    43 				System.out.println("    " + t);
    44 			}
    45 		}
    46 
    47 
    48 
    49 
    50 	}
    51 }