use of com.ociweb.pronghorn.pipe.DataOutputBlobWriter in project PronghornPipes by oci-pronghorn.
the class TrieParserTest method testwriteCapturedShort.
@Test
public void testwriteCapturedShort() {
TrieParserReader reader = new TrieParserReader(3);
TrieParser map = new TrieParser(16);
map.setUTF8Value("12%iabcd", 33);
CharSequence test = "128abcd";
// query holds most recent thing
reader.query(map, test);
Pipe<RawDataSchema> pipe = RawDataSchema.instance.newPipe(2, 64);
pipe.initBuffers();
int size = Pipe.addMsgIdx(pipe, RawDataSchema.MSG_CHUNKEDSTREAM_1);
DataOutputBlobWriter x = Pipe.outputStream(pipe);
DataOutputBlobWriter.openField(x);
TrieParserReader.writeCapturedShort(reader, 0, x);
x.closeLowLevelField();
Pipe.confirmLowLevelWrite(pipe, size);
Pipe.publishWrites(pipe);
// /////////
int msg = Pipe.takeMsgIdx(pipe);
assertEquals(RawDataSchema.MSG_CHUNKEDSTREAM_1, msg);
DataInputBlobReader y = Pipe.inputStream(pipe);
y.openLowLevelAPIField();
// 2nd value has length of captured field.
byte[] vals = new byte[2];
y.read(vals);
assertEquals(vals[1], 8);
}
Aggregations