@Override public String toString() { return content.toString(CharsetUtil.UTF_8); } }
@Override public String getString(Charset encoding) { if (byteBuf == null) { return ""; } if (encoding == null) { encoding = HttpConstants.DEFAULT_CHARSET; } return byteBuf.toString(encoding); }
/** * Return {@link ByteBuf#toString()} without checking the reference count first. This is useful to implement * {@link #toString()}. */ protected final String contentToString() { return data.toString(); }
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception { out.add(msg.toString(charset)); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MultiResult that = (MultiResult) o; if (statusCode != that.statusCode) return false; if (status != that.status) return false; if (path != null ? !path.equals(that.path) : that.path != null) return false; if (operation != that.operation) return false; if (value == null) return that.value == null; return value.toString(CharsetUtil.UTF_8).equals(that.value.toString(CharsetUtil.UTF_8)); }
@Override public String toString() { StringBuilder result = new StringBuilder(); for (ByteBuf elt : value) { result.append(elt.toString(charset)); } return result.toString(); }
public void call(ByteBuf buf) { clientContextID = buf.toString(CHARSET); clientContextID = clientContextID.substring(1, clientContextID.length() - 1); buf.release(); } }),
@Override public int hashCode() { int result = (int) statusCode; result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (path != null ? path.hashCode() : 0); result = 31 * result + (operation != null ? operation.hashCode() : 0); if (value != null) { result = 31 * result + value.toString(CharsetUtil.UTF_8).hashCode(); } return result; }
public void call(ByteBuf buf) { clientContextID = buf.toString(CHARSET); clientContextID = clientContextID.substring(1, clientContextID.length() - 1); buf.release(); } }),
/** * Returns the text data in this frame */ public String text() { return content().toString(CharsetUtil.UTF_8); }
@Override public String toString(int index, int length, Charset charset) { checkIndex(index, length); return buffer.toString(index, length, charset); }
/** * Returns the text data in this frame */ public String text() { return content().toString(CharsetUtil.UTF_8); }
public void call(ByteBuf buf) { handle = buf.toString(CHARSET).replaceAll("^\"|\"$", ""); buf.release(); if (!sentResponse) { createResponse(); LOGGER.trace("Received handle for requestId {}", requestID); } } }),
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(operation()) .append('(').append(path()).append("): ") .append(status()); if (value.readableBytes() > 0) { builder.append(" = ").append(value().toString(CharsetUtil.UTF_8)); } return builder.toString(); } }
static String readUsAscii(ByteBuf buffer, int length) { String s = buffer.toString(buffer.readerIndex(), length, CharsetUtil.US_ASCII); buffer.skipBytes(length); return s; } }
@Override protected RawJsonDocument doDecode(String id, ByteBuf content, long cas, int expiry, int flags, ResponseStatus status) throws Exception { if (!TranscoderUtils.hasJsonFlags(flags)) { throw new TranscodingException("Flags (0x" + Integer.toHexString(flags) + ") indicate non-JSON document for " + "id " + id + ", could not decode."); } String converted = content.toString(CharsetUtil.UTF_8); return newDocument(id, expiry, converted, cas); }
@Override protected StringDocument doDecode(String id, ByteBuf content, long cas, int expiry, int flags, ResponseStatus status) throws Exception { if (!TranscoderUtils.hasStringFlags(flags)) { throw new TranscodingException("Flags (0x" + Integer.toHexString(flags) + ") indicate non-String document for " + "id " + id + ", could not decode."); } return newDocument(id, expiry, content.toString(CharsetUtil.UTF_8), cas); }
void setCurrentValue(ByteBuf value, int length) { this.currentValue = value; if (peekMode() == Mode.JSON_STRING_HASH_KEY) { //strip the quotes this.jsonPointer.addToken(this.currentValue.toString( this.currentValue.readerIndex() + 1, length - 1, Charset.defaultCharset())); } }
private void setFinalBuffer(ByteBuf buffer) throws IOException { currentAttribute.addContent(buffer, true); String value = decodeAttribute(currentAttribute.getByteBuf().toString(charset), charset); currentAttribute.setValue(value); addHttpData(currentAttribute); currentAttribute = null; }
@Override public String call(GetBucketConfigResponse response) { if (!response.status().isSuccess()) { response.content().release(); throw new IllegalStateException("Bucket config response did not return with success."); } LOGGER.debug("Successfully loaded config through carrier."); String content = response.content().toString(CharsetUtil.UTF_8); response.content().release(); return replaceHostWildcard(content, hostname); } });