/** * Reads text from specified field and calls setupParser for TrieParserReader to consume this data. * @param association Object associated object to find this field * @param target TrieParserReader target */ public boolean readTextAsParserSource(Object association, TrieParserReader target) { ChannelReader textReader = read(association); if (null!=textReader) { DataInputBlobReader.setupParser((DataInputBlobReader<?>)textReader, target, (int) textReader.readShort()); return true; } else { return false; } }
@Override public <A extends Appendable> A appendTo(StructuredReader activeReader, long id, A target) { return Appendables.appendValue(target, activeReader.read(id).readByte()); }
/** * Reads text from specified field and calls setupParser for TrieParserReader to consume this data. * @param association Object associated object to find this field * @param target TrieParserReader target */ public boolean readTextAsParserSource(Object association, TrieParserReader target) { ChannelReader textReader = read(association); if (null!=textReader) { DataInputBlobReader.setupParser((DataInputBlobReader<?>)textReader, target, (int) textReader.readShort()); return true; } else { return false; } }
@Override public <A extends Appendable> A appendTo(StructuredReader activeReader, long id, A target) { return Appendables.appendValue(target, activeReader.read(id).readByte()); }
public void read(HTTPHeader value, ChannelReader reader, long fieldId) { read(value,reader.structured().read(fieldId)); }
public ChannelReader read(Object association) { return read(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(channelReader))); }
public ChannelReader read(Object association) { StructRegistry structRegistry = Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)); int structId = DataInputBlobReader.getStructType(channelReader); assert ((StructRegistry.IS_STRUCT_BIT&structId) !=0 && (structId>0) ) : "Struct Id must be passed in, got "+structId; int idx = StructRegistry.lookupIndexOffset(structRegistry, association, structId); return read(structRegistry.buildFieldId(structId, idx)); }
public ChannelReader read(Object association) { StructRegistry structRegistry = Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)); int structId = DataInputBlobReader.getStructType(channelReader); assert ((StructRegistry.IS_STRUCT_BIT&structId) !=0 && (structId>0) ) : "Struct Id must be passed in, got "+structId; int idx = StructRegistry.lookupIndexOffset(structRegistry, association, structId); return read(structRegistry.buildFieldId(structId, idx)); }
private int echoHeaders(DataOutputBlobWriter<NetPayloadSchema> outputStream, int len, final int blobMask, byte[] blob, final int bytePosition, ChannelReader reader) { HTTPHeader[] headersToEcho = conStruct.headersToEcho(); if (null!=headersToEcho) { int newLinePos = (bytePosition+len-2); assert(blob[newLinePos&blobMask]=='\r'); assert(blob[(1+newLinePos)&blobMask]=='\n'); if (blob[newLinePos&blobMask]=='\r') { len-=2;//confirm it is \r\n? add assert! DataOutputBlobWriter.write(outputStream, blob, bytePosition, len, blobMask); len = 0;//so the following write will not write a second time. for(int i=0; i<headersToEcho.length; i++) { HTTPHeader header = headersToEcho[i]; if (!reader.structured().isNull(header)) { System.err.println("echo header "+header); spec.writeHeader(outputStream, header, reader.structured().read(header)); } //TODO: confirm works with chunked and not } outputStream.write(BYTES_NEWLINE); } } return len; }