@Override public boolean equalUTF(byte[] equalText) { int len = readShort(); if (len!=equalText.length) { return false; } int p = 0; int pp = position; while (--len>=0) { if (equalText[p++]!=backing[byteMask & pp++]) { return false; } } //only moves forward when equal. position = pp; return true; }
@Override public boolean equalUTF(byte[] equalText) { int len = readShort(); if (len!=equalText.length) { return false; } int p = 0; int pp = position; while (--len>=0) { if (equalText[p++]!=backing[byteMask & pp++]) { return false; } } //only moves forward when equal. position = pp; return true; }
@Override public boolean equalUTF(byte[] equalText) { int len = readShort(); if (len!=equalText.length) { return false; } int p = 0; int pp = position; while (--len>=0) { if (equalText[p++]!=backing[byteMask & pp++]) { return false; } } //only moves forward when equal. position = pp; return true; }
@Override public String readUTF() { //use this two line implementation int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length):null; }
@Override public <A extends Appendable> A readUTF(A target) { int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length, target):target; }
@Override public short readShort() { checkLimit(this,2); return super.readShort(); }
@Override public String readUTF() { //use this two line implementation int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length):null; }
@Override public <A extends Appendable> A readUTF(A target) { int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length, target):target; }
@Override public String readUTF() { //use this two line implementation int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length):null; }
@Override public <A extends Appendable> A readUTF(A target) { int length = readShort(); //read first 2 byte for length in bytes to convert. return length>=0?readUTFOfLength(length, target):target; }
/** * Checks to see if passed bytes are equal to field * @param fieldId field to compare * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(long fieldId, byte[] utf8EncodedBytes) { assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); if (channelReader.available()>=2) { int length = channelReader.readShort(); return utf8EncodedBytes.length==length && channelReader.equalBytes(utf8EncodedBytes); } } return false; }
/** * Checks to see if passed bytes are equal to field * @param fieldId field to compare * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(long fieldId, byte[] utf8EncodedBytes) { assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); if (channelReader.available()>=2) { int length = channelReader.readShort(); return utf8EncodedBytes.length==length && channelReader.equalBytes(utf8EncodedBytes); } } return false; }
/** * Checks to see if passed bytes are equal to field * @param fieldId field to compare * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(long fieldId, byte[] utf8EncodedBytes) { assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; final int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); if (channelReader.available()>=2) { int length = channelReader.readShort(); return utf8EncodedBytes.length==length && channelReader.equalBytes(utf8EncodedBytes); } } return false; }
short statusCode =stream.readShort();
/** * Reads text from specified field in pipe * @param association field association showing where to read * @return <code>true</code> if data exists, else <code>false</code> */ public boolean readText(Object association, StructuredWriter output) { final long fieldId = Pipe.structRegistry(DataInputBlobReader.getBackingPipe(this.channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(this.channelReader)); assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; assert(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldType(fieldId) == StructType.Text); int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); int length = channelReader.readShort();//length of text ChannelWriter out = output.writeBlob(association); out.writeShort(length); channelReader.readInto(out, length); return true; } return false; }
/** * Reads text from specified field in pipe * @param association field association showing where to read * @return <code>true</code> if data exists, else <code>false</code> */ public boolean readText(Object association, StructuredWriter output) { final long fieldId = Pipe.structRegistry(DataInputBlobReader.getBackingPipe(this.channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(this.channelReader)); assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; assert(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldType(fieldId) == StructType.Text); int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); int length = channelReader.readShort();//length of text ChannelWriter out = output.writeBlob(association); out.writeShort(length); channelReader.readInto(out, length); return true; } return false; }
/** * Reads text from specified field in pipe * @param association field association showing where to read * @return <code>true</code> if data exists, else <code>false</code> */ public boolean readText(Object association, StructuredWriter output) { final long fieldId = Pipe.structRegistry(DataInputBlobReader.getBackingPipe(this.channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(this.channelReader)); assert(0==Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).dims(fieldId)) : "This method only used for non dim fields."; assert(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldType(fieldId) == StructType.Text); int index = channelReader.readFromEndLastInt(StructRegistry.FIELD_MASK&(int)fieldId); if (index>=0) { channelReader.position(index); int length = channelReader.readShort();//length of text ChannelWriter out = output.writeBlob(association); out.writeShort(length); channelReader.readInto(out, length); return true; } return false; }