org.apache.jena.atlas.io.IO.readWholeFile()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(111)

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

IO.readWholeFile介绍

[英]Read a whole stream as UTF-8
[中]将整个流读取为UTF-8

代码示例

代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base

/** Copy the contents of an {@link InputStream} so it can be closed. */
public static InputStream copy(InputStream inputStream) {
  if ( inputStream == null )
    return null ;
  byte[] b = IO.readWholeFile(inputStream) ;
  InputStream x = new ByteArrayInputStream(b) ;
  return x ;
}

代码示例来源:origin: apache/jena

private void executeBody(HttpAction action) {
  InputStream input = null ;
  try { input = action.request.getInputStream() ; }
  catch (IOException ex) { ServletOps.errorOccurred(ex) ; }
  if ( action.verbose ) {
    // Verbose mode only .... capture request for logging (does not scale).
    byte[] bytes = IO.readWholeFile(input);
    input = new ByteArrayInputStream(bytes);
    try {
      String requestStr = Bytes.bytes2string(bytes) ;
      action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ;
    } catch (Exception ex) {
      action.log.info(format("[%d] Update = <failed to decode>", action.id)) ;
    }
  }
  execute(action, input) ;
  ServletOps.successNoContent(action) ;
}

代码示例来源:origin: org.apache.jena/jena-fuseki-core

private void executeBody(HttpAction action) {
  InputStream input = null ;
  try { input = action.request.getInputStream() ; }
  catch (IOException ex) { ServletOps.errorOccurred(ex) ; }
  if ( action.verbose ) {
    // Verbose mode only .... capture request for logging (does not scale).
    byte[] bytes = IO.readWholeFile(input);
    input = new ByteArrayInputStream(bytes);
    try {
      String requestStr = Bytes.bytes2string(bytes) ;
      action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ;
    } catch (Exception ex) {
      action.log.info(format("[%d] Update = <failed to decode>", action.id)) ;
    }
  }
  execute(action, input) ;
  ServletOps.successNoContent(action) ;
}

相关文章