Search in sources :

Example 1 with Syncable

use of org.apache.hadoop.fs.Syncable in project hadoop by apache.

the class CryptoStreamsTestBase method syncableCheck.

private void syncableCheck() throws IOException {
    OutputStream out = getOutputStream(smallBufferSize);
    try {
        int bytesWritten = dataLen / 3;
        out.write(data, 0, bytesWritten);
        ((Syncable) out).hflush();
        InputStream in = getInputStream(defaultBufferSize);
        verify(in, bytesWritten, data);
        in.close();
        out.write(data, bytesWritten, dataLen - bytesWritten);
        ((Syncable) out).hsync();
        in = getInputStream(defaultBufferSize);
        verify(in, dataLen, data);
        in.close();
    } finally {
        out.close();
    }
}
Also used : InputStream(java.io.InputStream) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) OutputStream(java.io.OutputStream) Syncable(org.apache.hadoop.fs.Syncable)

Aggregations

InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1 Syncable (org.apache.hadoop.fs.Syncable)1