slumberdb/slumberdb-service-model/src/main/java/org/boon/slumberdb/stores/log/BatchFileWriter.java
public void nextBufferToWrite(final ByteBuffer bufferOut) throws InterruptedException {
        dirty = true;
        final int size = bufferOut.limit();


        write(bufferOut);

        /* only increment bytes transferred after a successful write. */
        if (!error.get()) {
            totalBytesTransferred += size;
            bytesTransferred += size;
            bytesSinceLastFlush += size;
            buffersSent++;
        }


        if (this.bytesTransferred >= FILE_SIZE_BYTES || fileTimeOut.get()) {

            try {
                outputStream.close();
            } catch (IOException e) {
                cleanupOutputStream();
                e.printStackTrace(System.err);
            } finally {
                outputStream = null;
            }
        }


    }
public void nextBufferToWrite(final ByteBuffer bufferOut) throws InterruptedException {
        dirty = true;
        final int size = bufferOut.limit();


        write(bufferOut);

        /* only increment bytes transferred after a successful write. */
        if (!error.get()) {
            totalBytesTransferred += size;
            bytesTransferred += size;
            bytesSinceLastFlush += size;
            buffersSent++;
        }


        if (this.bytesTransferred >= FILE_SIZE_BYTES || fileTimeOut.get()) {

            try {
                outputStream.close();
            } catch (IOException e) {
                cleanupOutputStream();
                e.printStackTrace(System.err);
            } finally {
                outputStream = null;
            }
        }


    }
Writes a buffer of data to the log system.