@Override public Iterable<TupleDocument> convertRecord(String outputSchema, GenericRecord inputRecord, WorkUnitState workUnit) throws DataConversionException { String key = inputRecord.get(keyField).toString(); GenericRecord data = (GenericRecord) inputRecord.get(dataRecordField); ByteBuffer dataBytes = (ByteBuffer) data.get(valueField); Integer flags = (Integer) data.get(flagsField); ByteBuf buffer = Unpooled.copiedBuffer(dataBytes); return new SingleRecordIterable<>(new TupleDocument(key, Tuple.create(buffer, flags))); } }
private static ByteBuf deltaToFragment(long delta) { String sDelta = "" + delta; return Unpooled.copiedBuffer(sDelta, CharsetUtil.UTF_8); }
private static ByteBuf deltaToFragment(long delta) { String sDelta = "" + delta; return Unpooled.copiedBuffer(sDelta, CharsetUtil.UTF_8); }
/** * Creates a new big-endian buffer whose content is the specified * {@code array} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */ public static ByteBuf copiedBuffer(char[] array, Charset charset) { if (array == null) { throw new NullPointerException("array"); } return copiedBuffer(array, 0, array.length, charset); }
private static ByteBuf fromText(String text) { if (text == null || text.isEmpty()) { return Unpooled.EMPTY_BUFFER; } else { return Unpooled.copiedBuffer(text, CharsetUtil.UTF_8); } }
/** * Creates a new big-endian buffer whose content is the specified * {@code array} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */ public static ByteBuf copiedBuffer(char[] array, Charset charset) { if (array == null) { throw new NullPointerException("array"); } return copiedBuffer(array, 0, array.length, charset); }
/** * Sets the string for this frame * * @param text * text to store */ private static ByteBuf fromText(String text) { if (text == null || text.isEmpty()) { return Unpooled.EMPTY_BUFFER; } else { return Unpooled.copiedBuffer(text, CharsetUtil.UTF_8); } }
private static ByteBuf fromText(String text) { if (text == null || text.isEmpty()) { return Unpooled.EMPTY_BUFFER; } else { return Unpooled.copiedBuffer(text, CharsetUtil.UTF_8); } }
/** * Sets the string for this frame * * @param text * text to store */ private static ByteBuf fromText(String text) { if (text == null || text.isEmpty()) { return Unpooled.EMPTY_BUFFER; } else { return Unpooled.copiedBuffer(text, CharsetUtil.UTF_8); } }
/** * Creates a new big-endian buffer whose content is the specified * {@code string} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */ public static ByteBuf copiedBuffer(CharSequence string, Charset charset) { if (string == null) { throw new NullPointerException("string"); } if (string instanceof CharBuffer) { return copiedBuffer((CharBuffer) string, charset); } return copiedBuffer(CharBuffer.wrap(string), charset); }
/** * Creates a new big-endian buffer whose content is the specified * {@code string} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */ public static ByteBuf copiedBuffer(CharSequence string, Charset charset) { if (string == null) { throw new NullPointerException("string"); } if (string instanceof CharBuffer) { return copiedBuffer((CharBuffer) string, charset); } return copiedBuffer(CharBuffer.wrap(string), charset); }
/** * Creates a new big-endian buffer whose content is a subregion of * the specified {@code array} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */ public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) { if (array == null) { throw new NullPointerException("array"); } if (length == 0) { return EMPTY_BUFFER; } return copiedBuffer(CharBuffer.wrap(array, offset, length), charset); }
public void addValue(String value) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); this.value.add(buf); size += buf.readableBytes(); }
public void addValue(String value, int rank) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); this.value.add(rank, buf); size += buf.readableBytes(); }
public void addValue(String value, int rank) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); this.value.add(rank, buf); size += buf.readableBytes(); }
public void addValue(String value) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); this.value.add(buf); size += buf.readableBytes(); }
public void setValue(String value, int rank) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); ByteBuf old = this.value.set(rank, buf); if (old != null) { size -= old.readableBytes(); old.release(); } size += buf.readableBytes(); }
public void setValue(String value, int rank) { if (value == null) { throw new NullPointerException("value"); } ByteBuf buf = Unpooled.copiedBuffer(value, charset); ByteBuf old = this.value.set(rank, buf); if (old != null) { size -= old.readableBytes(); old.release(); } size += buf.readableBytes(); }
public static void init(ByteBuf buffer, String bucket) { MessageUtil.initRequest(MessageUtil.SELECT_BUCKET_OPCODE, buffer); ByteBuf key = Unpooled.copiedBuffer(bucket, CharsetUtil.UTF_8); MessageUtil.setKey(key, buffer); key.release(); } }
private void open(ChannelHandlerContext ctx) { ByteBuf request = ctx.alloc().buffer(); DcpOpenConnectionRequest.init(request); DcpOpenConnectionRequest.connectionName(request, Unpooled.copiedBuffer(connectionName, CharsetUtil.UTF_8)); ctx.writeAndFlush(request); }