1#include <Core/Types.h>
2#include <Common/hex.h>
3#include <Common/Exception.h>
4#include <IO/HexWriteBuffer.h>
5
6
7namespace DB
8{
9
10void HexWriteBuffer::nextImpl()
11{
12 if (!offset())
13 return;
14
15 for (Position p = working_buffer.begin(); p != pos; ++p)
16 {
17 UInt8 byte = *p;
18 out.write(hexDigitUppercase(byte / 16));
19 out.write(hexDigitUppercase(byte % 16));
20 }
21}
22
23HexWriteBuffer::~HexWriteBuffer()
24{
25 try
26 {
27 nextImpl();
28 }
29 catch (...)
30 {
31 tryLogCurrentException(__PRETTY_FUNCTION__);
32 }
33}
34
35}
36