/* * Flush buffers */ void Hex_Encoder::end_msg() { encode_and_send(in.data(), position); if(counter && line_length) send('\n'); counter = position = 0; }
/* * Flush buffers */ void Hex_Encoder::end_msg() { encode_and_send(m_in.data(), m_position); if(m_counter && m_line_length) send('\n'); m_counter = m_position = 0; }
/* * Flush buffers */ void Base64_Encoder::end_msg() { encode_and_send(m_in.data(), m_position, true); if(m_trailing_newline || (m_out_position && m_line_length)) send('\n'); m_out_position = m_position = 0; }
/* * Convert some data into Base64 */ void Base64_Encoder::write(const byte input[], size_t length) { buffer_insert(m_in, m_position, input, length); if(m_position + length >= m_in.size()) { encode_and_send(m_in.data(), m_in.size()); input += (m_in.size() - m_position); length -= (m_in.size() - m_position); while(length >= m_in.size()) { encode_and_send(input, m_in.size()); input += m_in.size(); length -= m_in.size(); } copy_mem(m_in.data(), input, length); m_position = 0; } m_position += length; }
/* * Convert some data into hex format */ void Hex_Encoder::write(const byte input[], size_t length) { buffer_insert(in, position, input, length); if(position + length >= in.size()) { encode_and_send(in.data(), in.size()); input += (in.size() - position); length -= (in.size() - position); while(length >= in.size()) { encode_and_send(input, in.size()); input += in.size(); length -= in.size(); } copy_mem(in.data(), input, length); position = 0; } position += length; }