gpt4 book ai didi

org.eclipse.persistence.oxm.XMLMarshaller.getEncoding()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 02:35:40 29 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.persistence.oxm.XMLMarshaller.getEncoding()方法的一些代码示例,展示了XMLMarshaller.getEncoding()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLMarshaller.getEncoding()方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.XMLMarshaller
类名称:XMLMarshaller
方法名:getEncoding

XMLMarshaller.getEncoding介绍

[英]Get the encoding set on this XMLMarshaller If the encoding has not been set the default UTF-8 will be used
[中]获取此XMLMarshaller上的编码集如果尚未设置编码,将使用默认的UTF-8

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo

/**
 * Saves the DataObject as an XML document with the specified root element.
 * Same as
 *   save(createDocument(dataObject, rootElementURI, rootElementName),
 *     outputStream, null);
 *
 * @param dataObject specifies DataObject to be saved
 * @param rootElementURI the Target Namespace URI of the root XML element
 * @param rootElementName the Name of the root XML element
 * @param outputStream specifies the OutputStream to write to.
 * @throws IOException for stream exceptions.
 * @throws IllegalArgumentException if the dataObject tree
 *    is not closed or has no container.
 */
public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws XMLMarshalException, IOException {
  XMLMarshaller xmlMarshaller = getXmlMarshaller(null);
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding());
  save(dataObject, rootElementURI, rootElementName, writer, xmlMarshaller);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Saves the DataObject as an XML document with the specified root element.
 * Same as
 *   save(createDocument(dataObject, rootElementURI, rootElementName),
 *     outputStream, null);
 *
 * @param dataObject specifies DataObject to be saved
 * @param rootElementURI the Target Namespace URI of the root XML element
 * @param rootElementName the Name of the root XML element
 * @param outputStream specifies the OutputStream to write to.
 * @throws IOException for stream exceptions.
 * @throws IllegalArgumentException if the dataObject tree
 *    is not closed or has no container.
 */
public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws XMLMarshalException, IOException {
  XMLMarshaller xmlMarshaller = getXmlMarshaller(null); 
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding());
  save(dataObject, rootElementURI, rootElementName, writer, xmlMarshaller);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException {
  XMLMarshaller xmlMarshaller = getXmlMarshaller();        
  XMLAttachmentMarshaller attachmentMarshaller = xmlMarshaller.getAttachmentMarshaller();
  //temporarily null out the attachment marshaller as it should not be used during serialization
  xmlMarshaller.setAttachmentMarshaller(null);
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding());    	
  save(xmlDocument, writer, xmlMarshaller);        
  xmlMarshaller.setAttachmentMarshaller(attachmentMarshaller);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo

public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException {
  XMLMarshaller xmlMarshaller = getXmlMarshaller();
  XMLAttachmentMarshaller attachmentMarshaller = xmlMarshaller.getAttachmentMarshaller();
  //temporarily null out the attachment marshaller as it should not be used during serialization
  xmlMarshaller.setAttachmentMarshaller(null);
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding());
  save(xmlDocument, writer, xmlMarshaller);
  xmlMarshaller.setAttachmentMarshaller(attachmentMarshaller);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.sdo

/**
 * Serializes an XMLDocument as an XML document into the outputStream.
 * If the DataObject's Type was defined by an XSD, the serialization
 *   will follow the XSD.
 * Otherwise the serialization will follow the format as if an XSD
 *   were generated as defined by the SDO specification.
 * The OutputStream will be flushed after writing.
 * Does not perform validation to ensure compliance with an XSD.
 * @param xmlDocument specifies XMLDocument to be saved
 * @param outputStream specifies the OutputStream to write to.
 * @param options implementation-specific options.
 * @throws IOException for stream exceptions.
 * @throws IllegalArgumentException if the dataObject tree
 *    is not closed or has no container.
 */
public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException {
  if (xmlDocument == null) {
    throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument"));
  }
  XMLMarshaller xmlMarshaller = getXmlMarshaller(options);
  String encoding = xmlMarshaller.getEncoding();
  if(xmlDocument.getEncoding() != null) {
    encoding = xmlDocument.getEncoding();
  }
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
  save(xmlDocument, writer, xmlMarshaller);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public Object getProperty(String propName) throws PropertyException {
  if (null == propName) {
    throw new IllegalArgumentException();
  }
  if (propName.equals(Marshaller.JAXB_ENCODING)) {
    return this.xmlBinder.getMarshaller().getEncoding();
  }
  if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) {
    return this.xmlBinder.getMarshaller().isFormattedOutput();
  }
  if (propName.equals(Marshaller.JAXB_FRAGMENT)) {
    return this.xmlBinder.getMarshaller().isFragment();
  }
  if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getSchemaLocation();
  }
  if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getNoNamespaceSchemaLocation();
  }
  throw new PropertyException(propName);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy

@Override
public Object getProperty(String propName) throws PropertyException {
  if (null == propName) {
    throw new IllegalArgumentException();
  }
  if (propName.equals(Marshaller.JAXB_ENCODING)) {
    return this.xmlBinder.getMarshaller().getEncoding();
  }
  if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) {
    return this.xmlBinder.getMarshaller().isFormattedOutput();
  }
  if (propName.equals(Marshaller.JAXB_FRAGMENT)) {
    return this.xmlBinder.getMarshaller().isFragment();
  }
  if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getSchemaLocation();
  }
  if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getNoNamespaceSchemaLocation();
  }
  throw new PropertyException(propName);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Serializes an XMLDocument as an XML document into the outputStream.
 * If the DataObject's Type was defined by an XSD, the serialization
 *   will follow the XSD.
 * Otherwise the serialization will follow the format as if an XSD
 *   were generated as defined by the SDO specification.
 * The OutputStream will be flushed after writing.
 * Does not perform validation to ensure compliance with an XSD.
 * @param xmlDocument specifies XMLDocument to be saved
 * @param outputStream specifies the OutputStream to write to.
 * @param options implementation-specific options.
 * @throws IOException for stream exceptions.
 * @throws IllegalArgumentException if the dataObject tree
 *    is not closed or has no container.
 */
public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException {
  if (xmlDocument == null) {
    throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument"));
  }
  XMLMarshaller xmlMarshaller = getXmlMarshaller(options);
  String encoding = xmlMarshaller.getEncoding();
  if(xmlDocument.getEncoding() != null) {
    encoding = xmlDocument.getEncoding();
  }
  OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding);
  save(xmlDocument, writer, xmlMarshaller);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy

return xmlMarshaller.isFormattedOutput();
} else if (JAXB_ENCODING.equals(key)) {
  return xmlMarshaller.getEncoding();
} else if (JAXB_SCHEMA_LOCATION.equals(key)) {
  return xmlMarshaller.getSchemaLocation();

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

return xmlMarshaller.isFormattedOutput();
} else if (JAXB_ENCODING.equals(key)) {
  return xmlMarshaller.getEncoding();
} else if (JAXB_SCHEMA_LOCATION.equals(key)) {
  return xmlMarshaller.getSchemaLocation();

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

boolean isXMLRoot = false;
String version = DEFAULT_XML_VERSION;
String encoding = getEncoding();
if (object instanceof XMLRoot) {
  isXMLRoot = true;

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

String encoding = getEncoding();
if (object instanceof XMLRoot) {
  isXMLRoot = true;

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

String encoding = getEncoding();
String version = DEFAULT_XML_VERSION;
if (!isXMLRoot) {

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com