@Override public String toString() { return (null != buffer ? buffer.toString() : "<EMPTY>"); }
public String toString() { return buf.toString(); } }
public String toString() { return buf.toString(); } }
@Override protected String toStringPayload() { return getPayload().toString(); }
@Override protected String toStringPayload() { return getPayload().toString(); }
@Override protected String toStringPayload() { return getPayload().toString(); }
public void compact() { final String before = buffer.toString(); buffer.compact(); logger.debug("Before compact: {}, after: {}", before, buffer); direction = Direction.WRITE; }
@Override public String toString() { return bytes().toString(); }
throw new IllegalArgumentException(e.getKey().toString());
@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; }
System.out.println(binarySecretData.toString());
@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(); }
@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; } }
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; } }
public String toString() { return buf.toString(); } }
@Override public String toString() { return (buffer == null) ? "TCByteBufferJDK14(null buffer)" : "TCByteBufferJDK14@" + System.identityHashCode(this) + "(" + buffer.toString() + ")"; }
private String getString(ByteBuffer src) { if (src == null) { log.error("Null buffer!"); return ""; } return src.toString(); }
private String getString(ByteBuffer src) { if (src == null) { log.error("Null buffer!"); return ""; } return src.toString(); }
@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(); }
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); } }