Lines
100 %
Functions
#include "source/extensions/common/dubbo/hessian2_utils.h"
namespace Envoy {
namespace Extensions {
namespace Common {
namespace Dubbo {
// Check
// https://github.com/apache/dubbo/blob/master/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ReflectUtils.java
// for details of parameters type.
uint32_t Hessian2Utils::getParametersNumber(const std::string& parameters_type) {
if (parameters_type.empty()) {
return 0;
}
uint32_t count = 0;
bool next = false;
for (auto ch : parameters_type) {
if (ch == '[') {
// Is array.
continue;
if (next && ch != ';') {
// Is Object.
switch (ch) {
case 'V':
case 'Z':
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
count++;
break;
case 'L':
// Start of Object.
next = true;
case ';':
// End of Object.
next = false;
default:
return count;
void BufferWriter::rawWrite(const void* data, uint64_t size) { buffer_.add(data, size); }
void BufferWriter::rawWrite(absl::string_view data) { buffer_.add(data); }
void BufferReader::rawReadNBytes(void* data, size_t len, size_t peek_offset) {
ASSERT(byteAvailable() - peek_offset >= len);
buffer_.copyOut(offset() + peek_offset, len, data);
} // namespace Dubbo
} // namespace Common
} // namespace Extensions
} // namespace Envoy