Search in sources :

Example 71 with Buffer

use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.

the class AnnotationTranscoder method decodeIntStringStringValue.

private Object decodeIntStringStringValue(byte[] data) {
    final Buffer buffer = new FixedBuffer(data);
    final int intValue = buffer.readSVInt();
    final String stringValue1 = BytesUtils.toString(buffer.readPrefixedBytes());
    final String stringValue2 = BytesUtils.toString(buffer.readPrefixedBytes());
    return new IntStringStringValue(intValue, stringValue1, stringValue2);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer)

Example 72 with Buffer

use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.

the class AnnotationTranscoder method decodeIntStringValue.

private Object decodeIntStringValue(byte[] data) {
    final Buffer buffer = new FixedBuffer(data);
    final int intValue = buffer.readSVInt();
    final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
    return new IntStringValue(intValue, stringValue);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue)

Example 73 with Buffer

use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.

the class AnnotationTranscoder method encodeIntStringValue.

private byte[] encodeIntStringValue(Object value) {
    final IntStringValue tIntStringValue = (IntStringValue) value;
    final int intValue = tIntStringValue.getIntValue();
    final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());
    // TODO increase by a more precise value
    final int bufferSize = getBufferSize(stringValue, 4 + 8);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putSVInt(intValue);
    buffer.putPrefixedBytes(stringValue);
    return buffer.getBuffer();
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 74 with Buffer

use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.

the class AnnotationTranscoder method encodeStringStringValue.

private byte[] encodeStringStringValue(Object o) {
    final StringStringValue tStringStringValue = (StringStringValue) o;
    final byte[] stringValue1 = BytesUtils.toBytes(tStringStringValue.getStringValue1());
    final byte[] stringValue2 = BytesUtils.toBytes(tStringStringValue.getStringValue2());
    // TODO increase by a more precise value
    final int bufferSize = getBufferSize(stringValue1, stringValue2);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putPrefixedBytes(stringValue1);
    buffer.putPrefixedBytes(stringValue2);
    return buffer.getBuffer();
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 75 with Buffer

use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.

the class AnnotationTranscoder method encodeIntBooleanIntBooleanValue.

private byte[] encodeIntBooleanIntBooleanValue(Object o) {
    final IntBooleanIntBooleanValue value = (IntBooleanIntBooleanValue) o;
    // int + int
    final Buffer buffer = new AutomaticBuffer(8);
    buffer.putVInt(value.getIntValue1());
    buffer.putBoolean(value.isBooleanValue1());
    buffer.putVInt(value.getIntValue2());
    buffer.putBoolean(value.isBooleanValue2());
    return buffer.getBuffer();
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Aggregations

Buffer (com.navercorp.pinpoint.common.buffer.Buffer)107 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)76 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)57 ByteBuffer (java.nio.ByteBuffer)27 Test (org.junit.Test)24 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)15 ApplicationStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext)11 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)11 AgentStatDataPointCodec (com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec)10 Date (java.util.Date)10 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)9 Cell (org.apache.hadoop.hbase.Cell)9 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)8 ArrayList (java.util.ArrayList)6 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)5 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)4 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)4 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)4 Put (org.apache.hadoop.hbase.client.Put)4 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)3