List of usage examples for io.netty.buffer ByteBuf writerIndex
public abstract int writerIndex();
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w.ja v a 2 s . co m * @see com.heliosapm.ohcrs.core.DriverCodec#write(short, io.netty.buffer.ByteBuf) */ @Override public int write(final short p, final ByteBuf b) throws SQLException { prefix(P, DBType.SMALLINT, b); b.writeShort(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w .j a v a 2 s . com * @see com.heliosapm.ohcrs.core.DriverCodec#write(int, io.netty.buffer.ByteBuf) */ @Override public int write(final Integer p, final ByteBuf b) throws SQLException { prefix(p, DBType.INTEGER, b); b.writeInt(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}/*from ww w . ja v a2s .com*/ * @see com.heliosapm.ohcrs.core.DriverCodec#write(int, io.netty.buffer.ByteBuf) */ @Override public int write(final int p, final ByteBuf b) throws SQLException { prefix(P, DBType.INTEGER, b); b.writeInt(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w . jav a2 s .c o m * @see com.heliosapm.ohcrs.core.DriverCodec#write(float, io.netty.buffer.ByteBuf) */ @Override public int write(final Float p, final ByteBuf b) throws SQLException { prefix(p, DBType.FLOAT, b); b.writeFloat(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}// w w w .j a va2 s.c o m * @see com.heliosapm.ohcrs.core.DriverCodec#write(float, io.netty.buffer.ByteBuf) */ @Override public int write(final float p, final ByteBuf b) throws SQLException { prefix(P, DBType.FLOAT, b); b.writeFloat(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w . java 2 s . c om * @see com.heliosapm.ohcrs.core.DriverCodec#write(long, io.netty.buffer.ByteBuf) */ @Override public int write(final Long p, final ByteBuf b) throws SQLException { prefix(p, DBType.BIGINT, b); b.writeLong(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w. j a va 2s. c om * @see com.heliosapm.ohcrs.core.DriverCodec#write(long, io.netty.buffer.ByteBuf) */ @Override public int write(final long p, final ByteBuf b) throws SQLException { prefix(P, DBType.BIGINT, b); b.writeLong(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//w w w . ja v a 2 s . c om * @see com.heliosapm.ohcrs.core.DriverCodec#write(double, io.netty.buffer.ByteBuf) */ @Override public int write(final Double p, final ByteBuf b) throws SQLException { prefix(p, DBType.DOUBLE, b); b.writeDouble(p); return b.writerIndex(); }
From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java
License:Apache License
/** * {@inheritDoc}//from w w w.j a va2 s .com * @see com.heliosapm.ohcrs.core.DriverCodec#write(double, io.netty.buffer.ByteBuf) */ @Override public int write(final double p, final ByteBuf b) throws SQLException { prefix(P, DBType.DOUBLE, b); b.writeDouble(p); return b.writerIndex(); }
From source file:com.heliosapm.streams.metrics.StreamedMetricValue.java
License:Apache License
/** * Writes a metric definition to the passed buffer * @param buff The buffer to write to//from w w w . j av a 2s . co m * @param valueType The value type * @param metricName The metric name * @param timestamp The metric timestamp * @param tags The metric tags * @return the number of bytes written */ public static int write(final ByteBuf buff, final ValueType valueType, final String metricName, final long timestamp, final Map<String, String> tags) { final int offset = buff.writerIndex(); buff.writeByte(TYPE_CODE); buff.writeByte(valueType == null ? 0 : valueType.ordinal() + 1); buff.writeLong(timestamp); BufferManager.writeUTF(metricName, buff); buff.writeByte(tags.size()); for (Map.Entry<String, String> entry : tags.entrySet()) { BufferManager.writeUTF(entry.getKey(), buff); BufferManager.writeUTF(entry.getValue(), buff); } return buff.writerIndex() - offset; }