public static System.IO.MemoryStream getStream(Document doc) { KXmlSerializer serializer = new KXmlSerializer(); System.IO.MemoryStream bos = new System.IO.MemoryStream(); //UPGRADE_TODO: Class 'java.io.DataOutputStream' was converted to 'System.IO.BinaryWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'" System.IO.BinaryWriter dos = new System.IO.BinaryWriter(bos); try { serializer.setOutput(dos, null); doc.write(serializer); serializer.flush(); return(bos); } catch (System.Exception e) { if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException) { ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace(); } else { SupportClass.WriteStackTrace(e, Console.Error); } return(null); } }
public static sbyte[] getUtfBytes(Document doc) { KXmlSerializer serializer = new KXmlSerializer(); System.IO.MemoryStream bos = new System.IO.MemoryStream(); try { //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Writer' and 'System.IO.StreamWriter' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'" //UPGRADE_TODO: Constructor 'java.io.OutputStreamWriter.OutputStreamWriter' was converted to 'System.IO.StreamWriter.StreamWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioOutputStreamWriterOutputStreamWriter_javaioOutputStream_javalangString'" System.IO.StreamWriter osw = new System.IO.StreamWriter(bos, System.Text.Encoding.GetEncoding("UTF-8")); serializer.setOutput(osw); doc.write(serializer); serializer.flush(); return(SupportClass.ToSByteArray(bos.ToArray())); } catch (System.Exception e) { if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException) { ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace(); } else { SupportClass.WriteStackTrace(e, Console.Error); } return(null); } }
public static System.String elementToString(Element e) { KXmlSerializer serializer = new KXmlSerializer(); System.IO.MemoryStream bos = new System.IO.MemoryStream(); //UPGRADE_TODO: Class 'java.io.DataOutputStream' was converted to 'System.IO.BinaryWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'" System.IO.BinaryWriter dos = new System.IO.BinaryWriter(bos); System.String s = null; try { serializer.setOutput(dos, null); e.write(serializer); serializer.flush(); //UPGRADE_TODO: The differences in the Format of parameters for constructor 'java.lang.String.String' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" s = System.Text.Encoding.GetEncoding("UTF-8").GetString(SupportClass.ToByteArray(SupportClass.ToSByteArray(bos.ToArray()))); return(s); } catch (System.IO.IOException uce) { SupportClass.WriteStackTrace(uce, Console.Error); } catch (System.Exception ex) { if (ex is org.javarosa.core.io.StreamsUtil.DirectionalIOException) { ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)ex).printStackTrace(); } else { SupportClass.WriteStackTrace(ex, Console.Error); } return(null); } return(null); }
public DataModelSerializer(KXmlSerializer serializer) { this.serializer = serializer; }
public DataModelSerializer(System.IO.Stream stream, InstanceInitializationFactory factory) { serializer = new KXmlSerializer(); serializer.setOutput(stream, "UTF-8"); this.factory = factory; }