当前位置: 首页>>代码示例>>Java>>正文


Java IndentedWriter.println方法代码示例

本文整理汇总了Java中org.apache.jena.atlas.io.IndentedWriter.println方法的典型用法代码示例。如果您正苦于以下问题:Java IndentedWriter.println方法的具体用法?Java IndentedWriter.println怎么用?Java IndentedWriter.println使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.atlas.io.IndentedWriter的用法示例。


在下文中一共展示了IndentedWriter.println方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collected

import org.apache.jena.atlas.io.IndentedWriter; //导入方法依赖的package包/类
private void send$() {
    long number = counter.incrementAndGet();
    
    byte[] bytes = collected();
    String idStr;
    
    if ( patchId != null )
        idStr = Id.str(patchId);
    else
        idStr = Long.toString(number);
    FmtLog.info(LOG, "Send patch %s (%d bytes) -> %s", idStr, bytes.length, label);
    
    if ( false ) {
        if ( LOG.isDebugEnabled() ) {
            // Ouch.
            String s = new String(bytes, StandardCharsets.UTF_8);
            LOG.debug("== Sending ...");
            // Do NOT close!
            IndentedWriter w = IndentedWriter.stdout;
            String x = w.getLinePrefix();
            w.setLinePrefix(">> ");
            w.print(s);
            w.setLinePrefix(x);
            if ( ! s.endsWith("\n") )
                w.println();
            w.flush();
            LOG.debug("== ==");
        }
    }
    
    int attempts = 0 ;
    for(;;) {
        
        HttpPost postRequest = new HttpPost(urlSupplier.get());
        postRequest.setEntity(new ByteArrayEntity(bytes));

        try(CloseableHttpResponse r = httpClient.execute(postRequest) ) {
            attempts++;
            statusLine = r.getStatusLine();
            response = readResponse(r);
            int sc = r.getStatusLine().getStatusCode();
            if ( sc >= 200 && sc <= 299 )
                return ;
            if ( sc >= 300 && sc <= 399 ) {
                FmtLog.info(LOG, "Send patch %s HTTP %d", idStr, sc);
                throw new DeltaHttpException(sc, "HTTP Redirect");
            }
            if ( sc == 401 && attempts == 1 && resetAction != null ) {
                resetAction.run();
                continue;
            }
            if ( sc >= 400 && sc <= 499 )
                throw new DeltaHttpException(sc, r.getStatusLine().getReasonPhrase());
            if ( sc >= 500 )
                throw new DeltaHttpException(sc, r.getStatusLine().getReasonPhrase());
            break;
        }
        catch (DeltaHttpException ex) { throw ex; }
        catch (IOException e) { throw IOX.exception(e); }
    }
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:62,代码来源:RDFChangesHTTP.java

示例2: print

import org.apache.jena.atlas.io.IndentedWriter; //导入方法依赖的package包/类
public void print(IndentedWriter out) {
    out.print(LzConfParserYAML.objVNode) ;
    out.println(": [") ;
    placements.forEach((s,vn) -> {
        if ( vn.localFileRoot == null )
            out.printf("  { vname: \"%s\" , :hostname \"%s\" , :port \"%d\" } ,\n", 
                       vn.vname, vn.getAdminEndpoint().getName(), vn.getAdminEndpoint().getPort()) ;
        else
            out.printf("  { vname: \"%s\" , :hostname \"%s\" , :port \"%d\", :fileroot \"%s\" } ,\n", 
                       vn.vname, vn.getAdminEndpoint().getName(), vn.getAdminEndpoint().getPort(), vn.localFileRoot) ;
        }) ;
    out.println("]") ;
    
    out.print(LzConfParserYAML.objCluster) ;
    out.println(":") ;
   
    out.incIndent();
    out.print(LzConfParserYAML.objZookeeper);
    out.print(": ") ;
    out.print("[ ") ;
    zkServer.stream().forEach(zk -> { zk.print(out); out.print(", "); }) ;
    out.print("]") ;
    out.decIndent();
    out.println() ;
    
    out.print(LzConfParserYAML.objDataset);
    out.println(":") ;
    out.incIndent();
    out.print("indexes: [") ;
    eltsIndex.stream().map(elt -> elt.conf).distinct().forEach(idx -> {
        idx.print(out);
        out.print(", ");
    }) ;
    out.print("]") ;
    out.println() ;
    
    out.print("nodes: ") ;
    out.print("[ ") ;
    eltsNodeTable.stream().map(elt -> elt.conf).distinct().forEach(nt -> {
        nt.print(out);
        out.print(", ");
    }) ;
    out.print("]") ;
    
    
    out.decIndent();
    out.println() ;
    
}
 
开发者ID:afs,项目名称:lizard,代码行数:50,代码来源:ConfCluster.java


注:本文中的org.apache.jena.atlas.io.IndentedWriter.println方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。