本文整理了Java中java.nio.ByteBuffer.toString()
方法的一些代码示例,展示了ByteBuffer.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.toString()
方法的具体详情如下:
包路径:java.nio.ByteBuffer
类名称:ByteBuffer
方法名:toString
[英]Returns a string representing the state of this byte buffer.
[中]返回表示此字节缓冲区状态的字符串。
代码示例来源:origin: redisson/redisson
@Override
public String toString() {
return (null != buffer ? buffer.toString() : "<EMPTY>");
}
代码示例来源:origin: wildfly/wildfly
public String toString() {
return buf.toString();
}
}
代码示例来源:origin: wildfly/wildfly
public String toString() {
return buf.toString();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected String toStringPayload() {
return getPayload().toString();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected String toStringPayload() {
return getPayload().toString();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected String toStringPayload() {
return getPayload().toString();
}
代码示例来源:origin: apache/nifi
public void compact() {
final String before = buffer.toString();
buffer.compact();
logger.debug("Before compact: {}, after: {}", before, buffer);
direction = Direction.WRITE;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public String toString() {
return bytes().toString();
}
代码示例来源:origin: tjake/Solandra
throw new IllegalArgumentException(e.getKey().toString());
代码示例来源:origin: apache/flume
@Override
public Void append( AvroFlumeOGEvent evt ) throws AvroRemoteException {
counterGroup.incrementAndGet("rpc.received");
Map<String, String> headers = new HashMap<String, String>();
// extract Flume OG event headers
headers.put(HOST, evt.getHost().toString());
headers.put(TIMESTAMP, evt.getTimestamp().toString());
headers.put(PRIORITY, evt.getPriority().toString());
headers.put(NANOS, evt.getNanos().toString());
for (Entry<CharSequence, ByteBuffer> entry : evt.getFields().entrySet()) {
headers.put(entry.getKey().toString(), entry.getValue().toString());
}
headers.put(OG_EVENT, "yes");
Event event = EventBuilder.withBody(evt.getBody().array(), headers);
try {
getChannelProcessor().processEvent(event);
counterGroup.incrementAndGet("rpc.events");
} catch (ChannelException ex) {
return null;
}
counterGroup.incrementAndGet("rpc.successful");
return null;
}
代码示例来源:origin: awsdocs/aws-doc-sdk-examples
System.out.println(binarySecretData.toString());
代码示例来源:origin: Genymobile/gnirehtet
@Override
public void write(byte[] b, int off, int len) throws IOException {
if (len > MAX_IP_PACKET_LENGTH) {
throw new IOException("IPPacketOutputStream does not support writing more than one packet at a time");
}
// by design, the buffer must always have enough space for one packet
if (BuildConfig.DEBUG && len > buffer.remaining()) {
Log.e(TAG, len + " must be <= than " + buffer.remaining());
Log.e(TAG, buffer.toString());
throw new AssertionError("Buffer is unexpectedly full");
}
buffer.put(b, off, len);
buffer.flip();
sink();
buffer.compact();
}
代码示例来源:origin: advantageous/qbit
@SuppressWarnings("UnusedReturnValue")
public boolean flushStatSend() {
try {
final int sizeOfBuffer = sendBuffer.position();
if (sizeOfBuffer <= 0) {
return false;
}
final int sentByteCount = sendBufferOverChannel();
if (sizeOfBuffer == sentByteCount) {
return true;
} else {
logger.error(String.format(
"Could not send all of stat %s to host %s:%d. Only sent %d bytes out of %d bytes", sendBuffer.toString(),
address.getHostName(), address.getPort(), sentByteCount, sizeOfBuffer));
return false;
}
} catch (IOException e) {
logger.error(
String.format("Could not send stat %s to host %s:%d", sendBuffer.toString(), address.getHostName(),
address.getPort()), e);
return false;
}
}
代码示例来源:origin: advantageous/qbit
private boolean doSend(String stat) {
try {
final byte[] data = stat.getBytes("utf-8");
// If we're going to go past the threshold of the buffer then flush.
// the +1 is for the potential '\n' in multi_metrics below
if (sendBuffer.remaining() < (data.length + 1)) {
if (!flushStatSend()) {
logger.error("Buffer overflow, connection might be down");
return false;
}
}
if (sendBuffer.position() > 0) { // multiple metrics are separated by '\n'
sendBuffer.put((byte) '\n');
}
sendBuffer.put(data); // append the data
if (!multiMetrics) {
flushStatSend();
}
return true;
} catch (IOException e) {
logger.error(
String.format("Could not send stat %s to host %s:%d",
sendBuffer.toString(), address.getHostName(),
address.getPort()), e);
return false;
}
}
代码示例来源:origin: apache/activemq-artemis
public String toString() {
return buf.toString();
}
}
代码示例来源:origin: org.terracotta/terracotta-l1-ee
@Override
public String toString() {
return (buffer == null) ? "TCByteBufferJDK14(null buffer)" : "TCByteBufferJDK14@" + System.identityHashCode(this)
+ "(" + buffer.toString() + ")";
}
代码示例来源:origin: undera/jmeter-plugins
private String getString(ByteBuffer src) {
if (src == null) {
log.error("Null buffer!");
return "";
}
return src.toString();
}
代码示例来源:origin: kg.apc/jmeter-plugins-emulators
private String getString(ByteBuffer src) {
if (src == null) {
log.error("Null buffer!");
return "";
}
return src.toString();
}
代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel
@Override
public String toString() {
StringBundler sb = new StringBundler(11);
sb.append("{dataChunk=");
ByteBuffer byteBuffer = _dataByteBuffer;
if (byteBuffer == null) {
sb.append(StringPool.NULL);
}
else {
sb.append(byteBuffer.toString());
}
sb.append(", dataSize=");
sb.append(BigEndianCodec.getInt(_headerBufferArray, _INDEX_DATA_SIZE));
sb.append(", dataType=");
sb.append(_headerBufferArray[_INDEX_DATA_TYPE]);
sb.append(", sequenceId=");
sb.append(
BigEndianCodec.getLong(_headerBufferArray, _INDEX_SEQUENCE_ID));
sb.append(", statusFlag=");
sb.append(_headerBufferArray[_INDEX_STATUS_FLAG]);
sb.append("}");
return sb.toString();
}
代码示例来源:origin: org.mobicents.media.client/mgcp-driver
public void send(PacketRepresentation pr) {
try {
this.channel.send(pr.getBuffer(), pr.getInetAddress());
} catch (Exception e) {
logger.error("Could not send data " + pr.getBuffer().toString() + " to " + pr.getInetAddress().toString(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!