/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return length of data in that field */ public static int peekDataLength(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)+1)];// second int is always the length }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return length of data in that field */ public static int peekDataLength(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)+1)];// second int is always the length }
public static int peekDataMeta(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return length of data in that field */ public static int peekDataLength(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)+1)];// second int is always the length }
public static int peekDataMeta(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; }
public static int peekDataMeta(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; }
/** * Peeks ahead to specified field in pipe before Trie parsing is done * @param pipe pipe to read * @param loc field to peek in * @return int data in that field */ public static int peekInt(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readValue(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return long data in that field */ public static long peekLong(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readLong(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is done * @param pipe pipe to read * @param loc field to peek in * @return int data in that field */ public static int peekInt(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readValue(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return long data in that field */ public static long peekLong(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readLong(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is done * @param pipe pipe to read * @param loc field to peek in * @return int data in that field */ public static int peekInt(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readValue(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
public static int peekDataPosition(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); int meta = Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; return meta<0 ? POS_CONST_MASK & meta : Pipe.restorePosition(pipe, meta); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return long data in that field */ public static long peekLong(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); return Pipe.readLong(Pipe.slab(pipe),pipe.slabMask,pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc)); }
public static int peekDataPosition(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); int meta = Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; return meta<0 ? POS_CONST_MASK & meta : Pipe.restorePosition(pipe, meta); }
public static int peekDataPosition(Pipe pipe, int loc) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); int meta = Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+(OFF_MASK&loc))]; return meta<0 ? POS_CONST_MASK & meta : Pipe.restorePosition(pipe, meta); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return UTF8 data in that field */ public static <A extends Appendable> A peekUTF8(Pipe pipe, int loc, A target) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return (A)Pipe.readUTF8(pipe, target, peekDataPosition(pipe, loc), PipeReader.peekDataLength(pipe, loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return UTF8 data in that field */ public static <A extends Appendable> A peekUTF8(Pipe pipe, int loc, A target) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return (A)Pipe.readUTF8(pipe, target, peekDataPosition(pipe, loc), PipeReader.peekDataLength(pipe, loc)); }
/** * Peeks ahead to specified field in pipe before Trie parsing is run * @param pipe pipe to read * @param loc field to peek in * @return UTF8 data in that field */ public static <A extends Appendable> A peekUTF8(Pipe pipe, int loc, A target) { assert(PipeReader.hasContentToRead(pipe)) : "results would not be repeatable, before peek hasContentToRead must be called."; assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); return (A)Pipe.readUTF8(pipe, target, peekDataPosition(pipe, loc), PipeReader.peekDataLength(pipe, loc)); }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }