Changeset 6619
- Timestamp:
- 09/30/15 11:46:51 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.3-oeaw/vlo-vocabularies/src/main/java/eu/clarin/cmdi/vlo/transformers/VariantsMapMarshaller.java
r6617 r6619 3 3 import java.io.InputStream; 4 4 import java.io.OutputStream; 5 import java.util.Map; 5 import java.io.OutputStreamWriter; 6 import java.io.UnsupportedEncodingException; 7 import java.io.Writer; 8 import java.nio.charset.StandardCharsets; 6 9 7 10 import javax.xml.bind.JAXBContext; … … 27 30 28 31 29 public static void marshal(VariantsMap map, OutputStream output) throws JAXBException{ 30 31 Map<String, String> vocab = map.getInvertedMap(); 32 for(String key: vocab.keySet()){ 33 byte bytes[] = key.getBytes(); 34 StringBuilder sb = new StringBuilder(); 35 for (byte b : bytes) 36 sb.append(String.format("%02X ", b)); 37 38 LOG.info("Key <{} {}> will be mapped to <{}>", key, sb.toString(), vocab.get(key)); 39 } 32 public static void marshal(VariantsMap map, OutputStream output) throws JAXBException, UnsupportedEncodingException{ 40 33 41 34 JAXBContext jc = JAXBContext.newInstance(VariantsMap.class); 35 Writer out = new OutputStreamWriter(output, StandardCharsets.UTF_8); 42 36 43 37 Marshaller marshaller = jc.createMarshaller(); 44 38 marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); 45 marshaller.marshal(map, out put);39 marshaller.marshal(map, out); 46 40 } 47 41
Note: See TracChangeset
for help on using the changeset viewer.