Package org.apache.sysds.runtime.util
Class FastBufferedDataOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.sysds.runtime.util.FastBufferedDataOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable,MatrixBlockDataOutput
public class FastBufferedDataOutputStream
extends FilterOutputStream
implements DataOutput, MatrixBlockDataOutput
This buffered output stream is essentially a merged version of
BufferedOutputStream and DataOutputStream, wrt SystemDS requirements.
Micro-benchmarks showed a 25% performance improvement for local write binary block
due to the following advantages:
- 1) unsynchronized buffered output stream (not required in SystemDS since single writer)
- 2) single output buffer (avoid two-level buffers of individual streams)
- 3) specific support for writing double arrays in a blockwise fashion
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidwrite(byte[] b, int off, int len) voidwrite(int b) voidwriteBoolean(boolean v) voidwriteByte(int v) voidwriteBytes(String s) voidwriteChar(int v) voidwriteChars(String s) voidwriteDouble(double v) voidwriteDoubleArray(int len, double[] varr) Writes the double array of a dense block to the data output.voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidwriteShort(int v) voidwriteSparseRows(int rlen, SparseBlock rows) Writes the sparse rows array of a sparse block to the data output.voidMethods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.DataOutput
write
-
Constructor Details
-
FastBufferedDataOutputStream
-
FastBufferedDataOutputStream
-
-
Method Details
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
writeDoubleArray
Description copied from interface:MatrixBlockDataOutputWrites the double array of a dense block to the data output.- Specified by:
writeDoubleArrayin interfaceMatrixBlockDataOutput- Parameters:
len- ?varr- ?- Throws:
IOException- if IOException occurs
-
writeSparseRows
Description copied from interface:MatrixBlockDataOutputWrites the sparse rows array of a sparse block to the data output.- Specified by:
writeSparseRowsin interfaceMatrixBlockDataOutput- Parameters:
rlen- ?rows- sparse block- Throws:
IOException- if IOException occurs
-