Changeset 6619


Ignore:
Timestamp:
09/30/15 11:46:51 (9 years ago)
Author:
davor.ostojic@oeaw.ac.at
Message:
 
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  
    33import java.io.InputStream;
    44import java.io.OutputStream;
    5 import java.util.Map;
     5import java.io.OutputStreamWriter;
     6import java.io.UnsupportedEncodingException;
     7import java.io.Writer;
     8import java.nio.charset.StandardCharsets;
    69
    710import javax.xml.bind.JAXBContext;
     
    2730   
    2831   
    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{
    4033       
    4134        JAXBContext jc = JAXBContext.newInstance(VariantsMap.class);
     35        Writer out = new OutputStreamWriter(output, StandardCharsets.UTF_8);
    4236       
    4337        Marshaller marshaller = jc.createMarshaller();
    4438        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    45         marshaller.marshal(map, output);
     39        marshaller.marshal(map, out);
    4640    }
    4741
Note: See TracChangeset for help on using the changeset viewer.