org.apache.commons.io.input.XmlStreamReader.getXmlProlog()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(84)

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

XmlStreamReader.getXmlProlog介绍

[英]Returns the encoding declared in the , NULL if none.
[中]返回在中声明的编码,如果没有,则返回NULL。

代码示例

代码示例来源:origin: commons-io/commons-io

/**
 * Process the raw stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doRawStream(final BOMInputStream bom, final BOMInputStream pis, final boolean lenient)
    throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(null, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: commons-io/commons-io

/**
 * Process a HTTP stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param httpContentType The HTTP content type
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
    final boolean lenient) throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateHttpEncoding(httpContentType, bomEnc,
        xmlGuessEnc, xmlEnc, lenient);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(httpContentType, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Process the raw stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doRawStream(final BOMInputStream bom, final BOMInputStream pis, final boolean lenient)
    throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(null, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: Nextdoor/bender

/**
 * Process a HTTP stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param httpContentType The HTTP content type
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doHttpStream(BOMInputStream bom, BOMInputStream pis, String httpContentType,
    boolean lenient) throws IOException {
  String bomEnc      = bom.getBOMCharsetName();
  String xmlGuessEnc = pis.getBOMCharsetName();
  String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateHttpEncoding(httpContentType, bomEnc,
        xmlGuessEnc, xmlEnc, lenient);
  } catch (XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(httpContentType, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded

/**
 * Process a HTTP stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param httpContentType The HTTP content type
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
    final boolean lenient) throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateHttpEncoding(httpContentType, bomEnc,
        xmlGuessEnc, xmlEnc, lenient);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(httpContentType, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Process the raw stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doRawStream(BOMInputStream bom, BOMInputStream pis, boolean lenient)
    throws IOException {
  String bomEnc      = bom.getBOMCharsetName();
  String xmlGuessEnc = pis.getBOMCharsetName();
  String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
  } catch (XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(null, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded

/**
 * Process the raw stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doRawStream(final BOMInputStream bom, final BOMInputStream pis, final boolean lenient)
    throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(null, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Process a HTTP stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param httpContentType The HTTP content type
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doHttpStream(BOMInputStream bom, BOMInputStream pis, String httpContentType,
    boolean lenient) throws IOException {
  String bomEnc      = bom.getBOMCharsetName();
  String xmlGuessEnc = pis.getBOMCharsetName();
  String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateHttpEncoding(httpContentType, bomEnc,
        xmlGuessEnc, xmlEnc, lenient);
  } catch (XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(httpContentType, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: Nextdoor/bender

/**
 * Process the raw stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doRawStream(BOMInputStream bom, BOMInputStream pis, boolean lenient)
    throws IOException {
  String bomEnc      = bom.getBOMCharsetName();
  String xmlGuessEnc = pis.getBOMCharsetName();
  String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
  } catch (XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(null, ex);
    } else {
      throw ex;
    }
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Process a HTTP stream.
 *
 * @param bom BOMInputStream to detect byte order marks
 * @param pis BOMInputStream to guess XML encoding
 * @param httpContentType The HTTP content type
 * @param lenient indicates if the charset encoding detection should be
 *        relaxed.
 * @return the encoding to be used
 * @throws IOException thrown if there is a problem reading the stream.
 */
private String doHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
    final boolean lenient) throws IOException {
  final String bomEnc      = bom.getBOMCharsetName();
  final String xmlGuessEnc = pis.getBOMCharsetName();
  final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
  try {
    return calculateHttpEncoding(httpContentType, bomEnc,
        xmlGuessEnc, xmlEnc, lenient);
  } catch (final XmlStreamReaderException ex) {
    if (lenient) {
      return doLenientDetection(httpContentType, ex);
    } else {
      throw ex;
    }
  }
}

相关文章