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
 
 public class FastOutputStream extends OutputStream implements DataOutput Single threaded buffered OutputStream Internal Solr use only, subject to change.
- 
- 
Field SummaryFields Modifier and Type Field Description protected byte[]bufprotected OutputStreamoutprotected intposprotected longwritten
 - 
Constructor SummaryConstructors Constructor Description FastOutputStream(OutputStream w)FastOutputStream(OutputStream sink, byte[] tempBuffer, int start)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidflush(byte[] buf, int offset, int len)All writes to the sink will go through this methodvoidflushBuffer()Only 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)voidwriteUTF(String s)voidwriteUtf8CharSeq(Utf8CharSequence utf8)Copies 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.OutputStreamnullOutputStream
 
- 
 
- 
- 
- 
Field Detail- 
outprotected final OutputStream out 
 - 
bufprotected byte[] buf 
 - 
writtenprotected long written 
 - 
posprotected int pos 
 
- 
 - 
Constructor Detail- 
FastOutputStreampublic FastOutputStream(OutputStream w) 
 - 
FastOutputStreampublic FastOutputStream(OutputStream sink, byte[] tempBuffer, int start) 
 
- 
 - 
Method Detail- 
wrappublic static FastOutputStream wrap(OutputStream sink) 
 - 
writepublic void write(int b) throws IOException- Specified by:
- writein interface- DataOutput
- Specified by:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
writepublic void write(byte[] b) throws IOException- Specified by:
- writein interface- DataOutput
- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
writepublic void write(byte b) throws IOException- Throws:
- IOException
 
 - 
writepublic void write(byte[] arr, int off, int len) throws IOException- Specified by:
- writein interface- DataOutput
- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
 - 
reservepublic void reserve(int len) throws IOExceptionreserve at least len bytes at the end of the buffer. Invalid if len > buffer.length- Throws:
- IOException
 
 - 
writeBooleanpublic void writeBoolean(boolean v) throws IOException- Specified by:
- writeBooleanin interface- DataOutput
- Throws:
- IOException
 
 - 
writeBytepublic void writeByte(int v) throws IOException- Specified by:
- writeBytein interface- DataOutput
- Throws:
- IOException
 
 - 
writeShortpublic void writeShort(int v) throws IOException- Specified by:
- writeShortin interface- DataOutput
- Throws:
- IOException
 
 - 
writeCharpublic void writeChar(int v) throws IOException- Specified by:
- writeCharin interface- DataOutput
- Throws:
- IOException
 
 - 
writeIntpublic void writeInt(int v) throws IOException- Specified by:
- writeIntin interface- DataOutput
- Throws:
- IOException
 
 - 
writeLongpublic void writeLong(long v) throws IOException- Specified by:
- writeLongin interface- DataOutput
- Throws:
- IOException
 
 - 
writeFloatpublic void writeFloat(float v) throws IOException- Specified by:
- writeFloatin interface- DataOutput
- Throws:
- IOException
 
 - 
writeDoublepublic void writeDouble(double v) throws IOException- Specified by:
- writeDoublein interface- DataOutput
- Throws:
- IOException
 
 - 
writeBytespublic void writeBytes(String s) throws IOException - Specified by:
- writeBytesin interface- DataOutput
- Throws:
- IOException
 
 - 
writeCharspublic void writeChars(String s) throws IOException - Specified by:
- writeCharsin interface- DataOutput
- Throws:
- IOException
 
 - 
writeUTFpublic void writeUTF(String s) throws IOException - Specified by:
- writeUTFin interface- DataOutput
- Throws:
- IOException
 
 - 
flushpublic void flush() throws IOException- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- OutputStream
- Throws:
- IOException
 
 - 
flushBufferpublic void flushBuffer() throws IOExceptionOnly flushes the buffer of the FastOutputStream, not that of the underlying stream.- Throws:
- IOException
 
 - 
flushpublic void flush(byte[] buf, int offset, int len) throws IOExceptionAll writes to the sink will go through this method- Throws:
- IOException
 
 - 
sizepublic long size() 
 - 
writtenpublic long written() Returns the number of bytes actually written to the underlying OutputStream, not including anything currently buffered by this class itself.
 - 
setWrittenpublic void setWritten(long written) Resets the count returned by written()
 - 
writeUtf8CharSeqpublic void writeUtf8CharSeq(Utf8CharSequence utf8) throws IOException Copies aUtf8CharSequencewithout making extra copies- Throws:
- IOException
 
 
- 
 
-