███████████: development.

This commit is contained in:
Alexey Milovidov 2011-06-06 20:35:58 +00:00
parent a11485e186
commit 7b88ae65d8

View File

@ -73,11 +73,28 @@ public:
void ignore()
{
if (!eof())
{
++pos;
++bytes_read;
}
else
throw Exception("Attempt to read after eof", ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF);
}
void ignore(size_t n)
{
while (!eof() && n != 0)
{
size_t bytes_to_ignore = std::min(static_cast<size_t>(working_buffer.end() - pos), n);
pos += bytes_to_ignore;
n -= bytes_to_ignore;
bytes_read += bytes_to_ignore;
}
if (n)
throw Exception("Attempt to read after eof", ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF);
}
/** Читает столько, сколько есть, не больше n байт. */
size_t read(char * to, size_t n)
{