@Override public void read(HTTPHeader header, ChannelReader reader) { short type = reader.available()>=2 ? reader.readShort() : -1; if ((type<0) || (type>=httpSpec.contentTypes.length)) { this.type = HTTPContentTypeDefaults.UNKNOWN; } else { this.type = (HTTPContentType)httpSpec.contentTypes[type]; } }
@Override public void skipValue(ChannelReader reader) { //default assumes a UTF8 block capture short len = reader.readShort(); reader.skipBytes(len); }
public void visitHeaders(ChannelReader stream, Appendable target) { int id = stream.readShort(); while (id > 0) { try { target.append(headers[id].writingRoot()); headerConsume(id, stream, target); target.append("\n"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } id = stream.readShort(); } }
public <A extends Appendable> A writeValue(A target, HTTPSpecification<?,?,?,?> httpSpec, ChannelReader reader) { assert(null!=httpSpec) : "http spec required"; HTTPContentType contentType = httpSpec.getContentType(reader.readShort()); try { target.append(contentType.contentType()); } catch (IOException e) { throw new RuntimeException(e); } return target; } },
@Override public long consumeValue(ChannelReader reader) { long result = reader.readPackedLong(); //skip text short len = reader.readShort(); reader.skipBytes(len); return result; }
@Override public void skipValue(ChannelReader reader) { reader.readPackedLong(); short len = reader.readShort(); reader.skipBytes(len); }
/** * 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; } }
/** * 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; } }
int fieldNameLength = reader.readShort(); assert(fieldNameLength == -1);
int fieldNameLength = reader.readShort(); assert(fieldNameLength == -1);
int fieldNameLength = reader.readShort(); assert(fieldNameLength == -1);