Changeset 6617
- Timestamp:
- 09/30/15 10:20:10 (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
r6604 r6617 2 2 3 3 import java.io.InputStream; 4 import java.io.InputStreamReader;5 4 import java.io.OutputStream; 6 import java.io.UnsupportedEncodingException; 7 import java.nio.charset.StandardCharsets; 5 import java.util.Map; 8 6 9 7 import javax.xml.bind.JAXBContext; … … 12 10 import javax.xml.bind.Unmarshaller; 13 11 12 import org.slf4j.Logger; 13 import org.slf4j.LoggerFactory; 14 14 15 import eu.clarin.cmdi.vlo.pojo.VariantsMap; 15 16 16 17 public class VariantsMapMarshaller { 17 18 19 private final static Logger LOG = LoggerFactory.getLogger(VariantsMapMarshaller.class); 18 20 19 public static VariantsMap unmarshal(InputStream input)throws JAXBException , UnsupportedEncodingException{21 public static VariantsMap unmarshal(InputStream input)throws JAXBException{ 20 22 JAXBContext jc = JAXBContext.newInstance(VariantsMap.class); 21 23 Unmarshaller unmarshaller = jc.createUnmarshaller(); 22 InputStreamReader isr = new InputStreamReader(input, StandardCharsets.ISO_8859_1); 23 return (VariantsMap) unmarshaller.unmarshal(isr); 24 return (VariantsMap) unmarshaller.unmarshal(input); 24 25 25 26 } … … 27 28 28 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 } 40 29 41 JAXBContext jc = JAXBContext.newInstance(VariantsMap.class); 30 42
Note: See TracChangeset
for help on using the changeset viewer.