Package org.apache.solr.common.util
Class FastOutputStream
java.lang.Object
java.io.OutputStream
org.apache.solr.common.util.FastOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable
Single threaded buffered OutputStream Internal Solr use only, subject to change.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]protected final OutputStreamprotected intprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidflush(byte[] buf, int offset, int len) All writes to the sink will go through this methodvoidOnly flushes the buffer of the FastOutputStream, not that of the underlying stream.voidreserve(int len) reserve at least len bytes at the end of the buffer.voidsetWritten(long written) Resets the count returned by written()longsize()static FastOutputStreamwrap(OutputStream sink) voidwrite(byte b) voidwrite(byte[] b) voidwrite(byte[] arr, 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) voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidwriteShort(int v) voidvoidCopies aUtf8CharSequencewithout making extra copieslongwritten()Returns the number of bytes actually written to the underlying OutputStream, not including anything currently buffered by this class itself.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
out
-
buf
protected byte[] buf -
written
protected long written -
pos
protected int pos
-
-
Constructor Details
-
FastOutputStream
-
FastOutputStream
-
-
Method Details
-
wrap
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
reserve
reserve at least len bytes at the end of the buffer. Invalid if len > buffer.length- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flushBuffer
Only flushes the buffer of the FastOutputStream, not that of the underlying stream.- Throws:
IOException
-
flush
All writes to the sink will go through this method- Throws:
IOException
-
size
public long size() -
written
public long written()Returns the number of bytes actually written to the underlying OutputStream, not including anything currently buffered by this class itself. -
setWritten
public void setWritten(long written) Resets the count returned by written() -
writeUtf8CharSeq
Copies aUtf8CharSequencewithout making extra copies- Throws:
IOException
-