private OutputStream openURL(String filename) { return IO.openOutputFile(filename); } }
/** * Create an {@link StreamRDF} for output. A filenames ending {@code .gz} or {@code .bz2} will have * the respective compressor added to the output path. A filename of "-" is {@code System.out}. * The file is closed when {@link StreamRDF#finish()} is called unless it is {@code System.out}. * Call {@link StreamRDF#start()}...{@link StreamRDF#finish()}. * * @param filename The file * @param withValues - whether to encode numeric values as values. * @return StreamRDF A stream to send to. */ public static StreamRDF streamToFile(String filename, boolean withValues) { OutputStream out = IO.openOutputFile(filename) ; BufferedOutputStream bout = new BufferedOutputStream(out, BUFSIZE_OUT) ; TProtocol protocol = TRDF.protocol(bout) ; return new StreamRDF2Thrift(protocol, withValues) ; }
/** Connect to a destination for changes */ public static RDFChanges destination(String dest) { // TODO text vs binary if ( dest.startsWith("file:") ) { OutputStream out = IO.openOutputFile(dest) ; TokenWriter tokenWriter = new TokenWriterText(out) ; RDFChanges sc = new RDFChangesWriter(tokenWriter) ; return sc ; } if ( dest.startsWith("delta:") ) { // TCP connection delta:HOST:PORT throw new NotImplemented(dest) ; } if ( dest.startsWith("http:") || dest.startsWith("https:") ) { // Triggered on each transaction. return new RDFChangesHTTP(dest, dest) ; } throw new IllegalArgumentException("Not understood: "+dest) ; }
try ( OutputStream outCopy = IO.openOutputFile(systemFileCopy) ) { RDFDataMgr.write(outCopy, model, Lang.TURTLE) ; try ( OutputStream outCopy = IO.openOutputFile(configFile) ) { RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;
try ( OutputStream outCopy = IO.openOutputFile(systemFileCopy) ) { RDFDataMgr.write(outCopy, model, Lang.TURTLE) ; try ( OutputStream outCopy = IO.openOutputFile(configFile) ) { RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;