src/main/java/com/stijndepestel/geminio/Persister.java
/**
     * The function that can act as a Consumer to Capture.
     *
     * @param json
     *            The json to persist.
     */
The function that can act as a Consumer to Capture.
@param json
The json to persist.
The function that can act as a Consumer to Capture . @param json The json to persist .
public void persist(final JSONObject json) {
        if (!this.outputStream.isPresent()) {
            throw new IllegalStateException("Output stream not present.");
        }
        try (final BufferedWriter writer = new BufferedWriter(
                new OutputStreamWriter(this.outputStream.get(), "UTF8"))) {
            writer.append(json.toString());
            writer.flush();
        } catch (final IOException e) {
            LoggerFactory.getLogger(Persister.class.getName())
                    .error("IO Exception during persisting.", e);
        }
    }
public void persist ( final JSONObject json ) { if ( ! this . outputStream . isPresent ( ) ) { throw new IllegalStateException ( "Output stream not present." ) ; } try ( final BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( this . outputStream . get ( ) , "UTF8" ) ) ) { writer . append ( json . toString ( ) ) ; writer . flush ( ) ; } catch ( final IOException e ) { LoggerFactory . getLogger ( Persister . class . getName ( ) ) . error ( "IO Exception during persisting." , e ) ; } }
The function that can act as a Consumer to Capture.
The function that can act as a Consumer to Capture .