class FileInputStream
Defined at line 42 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h
A ZeroCopyInputStream which reads from a file descriptor.
FileInputStream is preferred over using an ifstream with IstreamInputStream.
The latter will introduce an extra layer of buffering, harming performance.
Also, it's conceivable that FileInputStream could someday be enhanced
to use zero-copy file descriptors on OSs which support them.
Public Methods
void FileInputStream (int file_descriptor, int block_size)
Creates a stream that reads from the given Unix file descriptor.
If a block_size is given, it specifies the number of bytes that
should be read and returned with each call to Next(). Otherwise,
a reasonable default is used.
bool Close ()
Flushes any buffers and closes the underlying file. Returns false if
an error occurs during the process; use GetErrno() to examine the error.
Even if an error occurs, the file descriptor is closed when this returns.
void FileInputStream (const FileInputStream & )
Defined at line 49 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h
FileInputStream & operator= (const FileInputStream & )
Defined at line 50 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h
void SetCloseOnDelete (bool value)
By default, the file descriptor is not closed when the stream is
destroyed. Call SetCloseOnDelete(true) to change that. WARNING:
This leaves no way for the caller to detect if close() fails. If
detecting close() errors is important to you, you should arrange
to close the descriptor yourself.
Defined at line 62 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h
int GetErrno ()
If an I/O error has occurred on this file descriptor, this is the
errno from that error. Otherwise, this is zero. Once an error
occurs, the stream is broken and all subsequent operations will
fail.
Defined at line 68 of file ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h
bool Next (const void ** data, int * size)
implements ZeroCopyInputStream ----------------------------------
void BackUp (int count)
bool Skip (int count)
int64_t ByteCount ()