public static String decodeHeader(Buffer value) { if (value == null) return null; ByteArrayOutputStream rc = new ByteArrayOutputStream(value.length); Buffer pos = new Buffer(value); int max = value.offset + value.length; while (pos.offset < max) { if (pos.startsWith(ESCAPE_ESCAPE_SEQ)) { rc.write(ESCAPE_BYTE); pos.moveHead(2); } else if (pos.startsWith(COLON_ESCAPE_SEQ)) { rc.write(COLON_BYTE); pos.moveHead(2); } else if (pos.startsWith(NEWLINE_ESCAPE_SEQ)) { rc.write(NEWLINE_BYTE); pos.moveHead(2); } else { rc.write(pos.data[pos.offset]); pos.moveHead(1); } } try { return new String(rc.toByteArray(), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // not expected. } }
public static String decodeHeader(Buffer value) { if (value == null) return null; ByteArrayOutputStream rc = new ByteArrayOutputStream(value.length); Buffer pos = new Buffer(value); int max = value.offset + value.length; while (pos.offset < max) { if (pos.startsWith(ESCAPE_ESCAPE_SEQ)) { rc.write(ESCAPE_BYTE); pos.moveHead(2); } else if (pos.startsWith(COLON_ESCAPE_SEQ)) { rc.write(COLON_BYTE); pos.moveHead(2); } else if (pos.startsWith(NEWLINE_ESCAPE_SEQ)) { rc.write(NEWLINE_BYTE); pos.moveHead(2); } else { rc.write(pos.data[pos.offset]); pos.moveHead(1); } } try { return new String(rc.toByteArray(), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // not expected. } }
try { int count = protonTransport.input(frame.data, frame.offset, frame.length); frame.moveHead(count); } catch (Throwable e) { handleException(new AmqpProtocolException("Could not decode AMQP frame: " + frame, true, e));
try { int count = protonTransport.input(frame.data, frame.offset, frame.length); frame.moveHead(count); } catch (Throwable e) { handleException(new AmqpProtocolException("Could not decode AMQP frame: " + frame, true, e));
if( sender.getCredit() > 0 ) { int sent = sender.send(currentBuffer.data, currentBuffer.offset, currentBuffer.length); currentBuffer.moveHead(sent); if( currentBuffer.length == 0 ) { Delivery current = currentDelivery;
int sent = getEndpoint().send(currentBuffer.data, currentBuffer.offset, currentBuffer.length); if (sent > 0) { currentBuffer.moveHead(sent); if (currentBuffer.length == 0) { if (presettle) {
int sent = getEndpoint().send(currentBuffer.data, currentBuffer.offset, currentBuffer.length); if (sent > 0) { currentBuffer.moveHead(sent); if (currentBuffer.length == 0) { if (presettle) {