public static int writeCapturedUTF8(TrieParserReader reader, int idx, ChannelWriter target) { int pos = idx*4; int type = reader.capturedValues[pos++]; assert(type==0); int p = reader.capturedValues[pos++]; int l = reader.capturedValues[pos++]; int m = reader.capturedValues[pos++]; //this data is already encoded as UTF8 so we do a direct copy target.writeShort(l); DataOutputBlobWriter.write((DataOutputBlobWriter<?>) target, reader.capturedBlobArray, p, l, m); return l; }
public static int writeCapturedUTF8(TrieParserReader reader, int idx, ChannelWriter target) { int pos = idx*4; int type = reader.capturedValues[pos++]; assert(type==0); int p = reader.capturedValues[pos++]; int l = reader.capturedValues[pos++]; int m = reader.capturedValues[pos++]; //this data is already encoded as UTF8 so we do a direct copy target.writeShort(l); DataOutputBlobWriter.write((DataOutputBlobWriter<?>) target, reader.capturedBlobArray, p, l, m); return l; }
public static int writeCapturedUTF8(TrieParserReader reader, int idx, ChannelWriter target) { int pos = idx*4; int type = reader.capturedValues[pos++]; assert(type==0); int p = reader.capturedValues[pos++]; int l = reader.capturedValues[pos++]; int m = reader.capturedValues[pos++]; //this data is already encoded as UTF8 so we do a direct copy target.writeShort(l); DataOutputBlobWriter.write((DataOutputBlobWriter<?>) target, reader.capturedBlobArray, p, l, m); return l; }
public void renderWithLengthPrefix(T source, ChannelWriter target) { int startPos = target.absolutePosition(); target.writeShort(-1);//hold these 2 for later int startTextPos = target.absolutePosition(); render(target, source); int stopTextPos = target.absolutePosition(); int length = stopTextPos-startTextPos; if (length>Short.MAX_VALUE) { throw new ArrayIndexOutOfBoundsException(); } target.absolutePosition(startPos); target.writeShort(length); //set the actual length now that we know. target.absolutePosition(stopTextPos); }
public void renderWithLengthPrefix(T source, ChannelWriter target) { int startPos = target.absolutePosition(); target.writeShort(-1);//hold these 2 for later int startTextPos = target.absolutePosition(); render(target, source); int stopTextPos = target.absolutePosition(); int length = stopTextPos-startTextPos; if (length>Short.MAX_VALUE) { throw new ArrayIndexOutOfBoundsException(); } target.absolutePosition(startPos); target.writeShort(length); //set the actual length now that we know. target.absolutePosition(stopTextPos); }
writer.writeShort(len); if (len>0) { writer.write(source, pos, (int)len); writer.writeShort(0);
writer.writeShort(len); if (len>0) { writer.write(source, pos, (int)len); writer.writeShort(0);
writer.writeShort(len); if (len>0) { writer.write(source, pos, (int)len); writer.writeShort(0);
/** * 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; }