本文整理了Java中com.couchbase.client.deps.io.netty.buffer.ByteBuf.toString()
方法的一些代码示例,展示了ByteBuf.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.toString()
方法的具体详情如下:
包路径:com.couchbase.client.deps.io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:toString
[英]Returns the string representation of this buffer. This method does not necessarily return the whole content of the buffer but returns the values of the key properties such as #readerIndex(), #writerIndex() and #capacity().
[中]返回此缓冲区的字符串表示形式。此方法不一定返回缓冲区的全部内容,但返回关键属性的值,如#readerIndex()、#writeridex()和#capacity()。
代码示例来源:origin: com.couchbase.client/core-io
@Override
public String toString() {
return content.toString(CharsetUtil.UTF_8);
}
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public String getString(Charset encoding) {
if (byteBuf == null) {
return "";
}
if (encoding == null) {
encoding = HttpConstants.DEFAULT_CHARSET;
}
return byteBuf.toString(encoding);
}
代码示例来源:origin: com.couchbase.client/core-io
/**
* Return {@link ByteBuf#toString()} without checking the reference count first. This is useful to implement
* {@link #toString()}.
*/
protected final String contentToString() {
return data.toString();
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
out.add(msg.toString(charset));
}
}
代码示例来源:origin: com.couchbase.client/core-io
@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));
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public String toString() {
StringBuilder result = new StringBuilder();
for (ByteBuf elt : value) {
result.append(elt.toString(charset));
}
return result.toString();
}
代码示例来源:origin: com.couchbase.client/core-io
public void call(ByteBuf buf) {
clientContextID = buf.toString(CHARSET);
clientContextID = clientContextID.substring(1, clientContextID.length() - 1);
buf.release();
}
}),
代码示例来源:origin: com.couchbase.client/core-io
@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;
}
代码示例来源:origin: com.couchbase.client/core-io
public void call(ByteBuf buf) {
clientContextID = buf.toString(CHARSET);
clientContextID = clientContextID.substring(1, clientContextID.length() - 1);
buf.release();
}
}),
代码示例来源:origin: com.couchbase.client/core-io
/**
* Returns the text data in this frame
*/
public String text() {
return content().toString(CharsetUtil.UTF_8);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public String toString(int index, int length, Charset charset) {
checkIndex(index, length);
return buffer.toString(index, length, charset);
}
代码示例来源:origin: com.couchbase.client/core-io
/**
* Returns the text data in this frame
*/
public String text() {
return content().toString(CharsetUtil.UTF_8);
}
代码示例来源:origin: com.couchbase.client/core-io
public void call(ByteBuf buf) {
handle = buf.toString(CHARSET).replaceAll("^\"|\"$", "");
buf.release();
if (!sentResponse) {
createResponse();
LOGGER.trace("Received handle for requestId {}", requestID);
}
}
}),
代码示例来源:origin: com.couchbase.client/core-io
@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();
}
}
代码示例来源:origin: com.couchbase.client/core-io
static String readUsAscii(ByteBuf buffer, int length) {
String s = buffer.toString(buffer.readerIndex(), length, CharsetUtil.US_ASCII);
buffer.skipBytes(length);
return s;
}
}
代码示例来源:origin: com.couchbase.client/java-client
@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);
}
代码示例来源:origin: com.couchbase.client/java-client
@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);
}
代码示例来源:origin: com.couchbase.client/core-io
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()));
}
}
代码示例来源:origin: com.couchbase.client/core-io
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;
}
代码示例来源:origin: com.couchbase.client/core-io
@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);
}
});
内容来源于网络,如有侵权,请联系作者删除!