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

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

本文整理了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

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

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

  1. private void executeBody(HttpAction action) {
  2. InputStream input = null ;
  3. try { input = action.request.getInputStream() ; }
  4. catch (IOException ex) { ServletOps.errorOccurred(ex) ; }
  5. if ( action.verbose ) {
  6. // Verbose mode only .... capture request for logging (does not scale).
  7. byte[] bytes = IO.readWholeFile(input);
  8. input = new ByteArrayInputStream(bytes);
  9. try {
  10. String requestStr = Bytes.bytes2string(bytes) ;
  11. action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ;
  12. } catch (Exception ex) {
  13. action.log.info(format("[%d] Update = <failed to decode>", action.id)) ;
  14. }
  15. }
  16. execute(action, input) ;
  17. ServletOps.successNoContent(action) ;
  18. }

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

  1. private void executeBody(HttpAction action) {
  2. InputStream input = null ;
  3. try { input = action.request.getInputStream() ; }
  4. catch (IOException ex) { ServletOps.errorOccurred(ex) ; }
  5. if ( action.verbose ) {
  6. // Verbose mode only .... capture request for logging (does not scale).
  7. byte[] bytes = IO.readWholeFile(input);
  8. input = new ByteArrayInputStream(bytes);
  9. try {
  10. String requestStr = Bytes.bytes2string(bytes) ;
  11. action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr))) ;
  12. } catch (Exception ex) {
  13. action.log.info(format("[%d] Update = <failed to decode>", action.id)) ;
  14. }
  15. }
  16. execute(action, input) ;
  17. ServletOps.successNoContent(action) ;
  18. }

相关文章