Refine search
long id = sent + 1; ByteArrayOutputStream os = new ByteArrayOutputStream(message.length + 15); os.write(new AsciiBuffer(Long.toString(id))); os.write(':'); os.write(body);
@Override public boolean equals(Object obj) { if( obj==this ) return true; if( obj==null || obj.getClass()!=AsciiBuffer.class ) return false; return equals((Buffer)obj); }
public static AsciiBuffer ascii(String value) { return AsciiBuffer.ascii(value); } public static AsciiBuffer ascii(Buffer buffer) {
public void writeExternal(java.io.DataOutput out) throws java.io.IOException { out.writeLong(bean.f_key); if( bean.f_bindingKind!=null ) { out.writeInt(bean.f_bindingKind.getLength()); out.write(bean.f_bindingKind.getData(), bean.f_bindingKind.getOffset(), bean.f_bindingKind.getLength()); } else { out.writeInt(-1); } if( bean.f_bindingData!=null ) { out.writeInt(bean.f_bindingData.getLength()); out.write(bean.f_bindingData.getData(), bean.f_bindingData.getOffset(), bean.f_bindingData.getLength()); } else { out.writeInt(-1); } }
public void readExternal(java.io.DataInput in) throws java.io.IOException { assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE; bean = this; frozen = null; f_key = in.readLong(); b_key = true; { int size = in.readInt(); if( size>=0 ) { byte b[] = new byte[size]; in.readFully(b); f_bindingKind = new org.fusesource.hawtbuf.AsciiBuffer(b); } else { f_bindingKind = null; } } { int size = in.readInt(); if( size>=0 ) { byte b[] = new byte[size]; in.readFully(b); f_bindingData = new org.fusesource.hawtbuf.Buffer(b); } else { f_bindingData = null; } } }
if( storeFreePages ) { if( recover ) { Buffer header = new Buffer(512); mappedFileFactory.getMemoryMappedFile().read(0, header); DataByteArrayInputStream his = new DataByteArrayInputStream(header); Buffer magic = new Buffer(HAWT_DB_PAGE_FILE_MAGIC.length()); his.readFully(magic.data, magic.offset, magic.length()); if( !magic.ascii().equals(HAWT_DB_PAGE_FILE_MAGIC)) { throw new IOPagingException("File's magic does not match expected value");
public boolean equals(Bean obj) { if (hasKey() ^ obj.hasKey() ) return false; if (hasKey() && ( getKey()!=obj.getKey() )) return false; if (hasBindingKind() ^ obj.hasBindingKind() ) return false; if (hasBindingKind() && ( !getBindingKind().equals(obj.getBindingKind()) )) return false; if (hasBindingData() ^ obj.hasBindingData() ) return false; if (hasBindingData() && ( !getBindingData().equals(obj.getBindingData()) )) return false; return true; }
public Object apply() throws IOException { Buffer line = readUntil((byte) '\n', max_header_length, "The maximum header length was exceeded"); if (line != null) { line = line.moveTail(-1); if (line.length > 0) { int seperatorIndex = line.indexOf(COLON_BYTE); if (seperatorIndex < 0) { throw new IOException("Header line missing seperator [" + line.ascii() + "]"); Buffer name = line.slice(0, seperatorIndex); StompFrame.HeaderEntry entry = new StompFrame.HeaderEntry(name.ascii(), value.ascii()); if (entry.key.equals(CONTENT_LENGTH)) { contentLengthValue[0] = entry.value; length = Integer.parseInt(contentLength.toString()); } catch (NumberFormatException e) { throw new IOException("Specified content-length is not a valid integer");
public void addContentLengthHeader() { addHeader(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(content.length()))); }
public StompFrame createCreditFrame(StompJmsMessageConsumer consumer, StompFrame messageFrame) { final Buffer content = messageFrame.content(); String credit = "1"; if( content!=null ) { credit += ","+content.length(); } StompFrame frame = new StompFrame(); frame.action(ACK); frame.headerMap().put(SUBSCRIPTION, consumer.id); frame.headerMap().put(CREDIT, AsciiBuffer.ascii(credit)); return frame; }
private void processStompFrame(StompFrame frame) { getDispatchQueue().assertExecuting(); AsciiBuffer action = frame.action(); if (action.equals(RECEIPT)) { AsciiBuffer id = frame.getHeader(RECEIPT_ID); if (id != null) { Callback<StompFrame> cb = this.requests.remove(id); if (cb != null) { cb.onSuccess(frame); } else { if( !toReceiver(frame) ) { processFailure(new ProtocolException("Stomp Response without a valid receipt id: " + id + " for frame " + frame)); } } } else { processFailure(new ProtocolException("Stomp Response with no receipt id: " + frame)); } } else if (action.startsWith(ERROR)) { processFailure(new ProtocolException("Received an error: " + frame.errorMessage())); } else { toReceiver(frame); } }
public String toString() { if( value == null ) { value = decode(this); } return value; }
public AsciiBuffer(String value) { super(encode(value)); this.value = value; }
public void writeExternal(java.io.DataOutput out) throws java.io.IOException { out.writeLong(bean.f_key); if( bean.f_bindingKind!=null ) { out.writeInt(bean.f_bindingKind.getLength()); out.write(bean.f_bindingKind.getData(), bean.f_bindingKind.getOffset(), bean.f_bindingKind.getLength()); } else { out.writeInt(-1); } if( bean.f_bindingData!=null ) { out.writeInt(bean.f_bindingData.getLength()); out.write(bean.f_bindingData.getData(), bean.f_bindingData.getOffset(), bean.f_bindingData.getLength()); } else { out.writeInt(-1); } }
public void readExternal(java.io.DataInput in) throws java.io.IOException { assert frozen==null : org.fusesource.hawtbuf.proto.MessageBufferSupport.FORZEN_ERROR_MESSAGE; bean = this; frozen = null; f_key = in.readLong(); b_key = true; { int size = in.readInt(); if( size>=0 ) { byte b[] = new byte[size]; in.readFully(b); f_bindingKind = new org.fusesource.hawtbuf.AsciiBuffer(b); } else { f_bindingKind = null; } } { int size = in.readInt(); if( size>=0 ) { byte b[] = new byte[size]; in.readFully(b); f_bindingData = new org.fusesource.hawtbuf.Buffer(b); } else { f_bindingData = null; } } }
if( storeFreePages ) { if( recover ) { Buffer header = new Buffer(512); mappedFileFactory.getMemoryMappedFile().read(0, header); DataByteArrayInputStream his = new DataByteArrayInputStream(header); Buffer magic = new Buffer(HAWT_DB_PAGE_FILE_MAGIC.length()); his.readFully(magic.data, magic.offset, magic.length()); if( !magic.ascii().equals(HAWT_DB_PAGE_FILE_MAGIC)) { throw new IOPagingException("File's magic does not match expected value");
public boolean equals(Bean obj) { if (hasKey() ^ obj.hasKey() ) return false; if (hasKey() && ( getKey()!=obj.getKey() )) return false; if (hasBindingKind() ^ obj.hasBindingKind() ) return false; if (hasBindingKind() && ( !getBindingKind().equals(obj.getBindingKind()) )) return false; if (hasBindingData() ^ obj.hasBindingData() ) return false; if (hasBindingData() && ( !getBindingData().equals(obj.getBindingData()) )) return false; return true; }
public Object apply() throws IOException { Buffer line = readUntil((byte) '\n', max_header_length, "The maximum header length was exceeded"); if (line != null) { line = line.moveTail(-1); if (line.length > 0) { int seperatorIndex = line.indexOf(COLON_BYTE); if (seperatorIndex < 0) { throw new IOException("Header line missing seperator [" + line.ascii() + "]"); Buffer name = line.slice(0, seperatorIndex); StompFrame.HeaderEntry entry = new StompFrame.HeaderEntry(name.ascii(), value.ascii()); if (entry.key.equals(CONTENT_LENGTH)) { contentLengthValue[0] = entry.value; length = Integer.parseInt(contentLength.toString()); } catch (NumberFormatException e) { throw new IOException("Specified content-length is not a valid integer");