Java Code Examples for org.apache.jena.atlas.io.IO#openOutputFile()

The following examples show how to use org.apache.jena.atlas.io.IO#openOutputFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeltaClientLib.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
/** 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) ;
}
 
Example 2
Source File: RDFChangesWriterBinary.java    From rdf-delta with Apache License 2.0 4 votes vote down vote up
public static void write(RDFPatch patch, String filename) {
    try ( OutputStream out = IO.openOutputFile(filename) ) {
        write(patch, out);
    } catch (IOException ex) { IO.exception(ex); }
}