Interface TsFileOutput
-
- All Known Implementing Classes:
LocalTsFileOutput
public interface TsFileOutput
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()close the output.voidflush()the same withOutputStream.flush().voidforce()Make sure that the data in the buffer is flushed to disklonggetPosition()gets the current position of the Output.voidtruncate(long size)The same withFileChannel.truncate(long).OutputStreamwrapAsStream()convert this TsFileOutput as a outputstream.voidwrite(byte b)Writes 1 byte to this output at the current position.voidwrite(byte[] b)Writesb.lengthbytes from the specified byte array to this output at the current position.voidwrite(ByteBuffer b)Writesb.remaining()bytes from the specified byte array to this output at the current position.
-
-
-
Method Detail
-
write
void write(byte[] b) throws IOExceptionWritesb.lengthbytes from the specified byte array to this output at the current position.- Parameters:
b- the data.- Throws:
IOException- if an I/O error occurs.
-
write
void write(byte b) throws IOExceptionWrites 1 byte to this output at the current position.- Parameters:
b- the data.- Throws:
IOException- if an I/O error occurs.
-
write
void write(ByteBuffer b) throws IOException
Writesb.remaining()bytes from the specified byte array to this output at the current position.- Parameters:
b- the data.- Throws:
IOException- if an I/O error occurs.
-
getPosition
long getPosition() throws IOExceptiongets the current position of the Output. This method is usually used for recording where the data is.
For example, if the Output is a fileOutputStream, then getPosition returns its file position.- Returns:
- current position
- Throws:
IOException- if an I/O error occurs.
-
close
void close() throws IOExceptionclose the output.- Throws:
IOException- if an I/O error occurs.
-
wrapAsStream
OutputStream wrapAsStream() throws IOException
convert this TsFileOutput as a outputstream.- Returns:
- an output stream whose position is the same with this Output
- Throws:
IOException- if an I/O error occurs.
-
flush
void flush() throws IOExceptionthe same withOutputStream.flush().- Throws:
IOException- if an I/O error occurs.
-
truncate
void truncate(long size) throws IOExceptionThe same withFileChannel.truncate(long).- Parameters:
size- size The new size, a non-negative byte count- Throws:
IOException
-
force
void force() throws IOExceptionMake sure that the data in the buffer is flushed to disk- Throws:
IOException
-
-