private static <S extends MessageSchema<S>> boolean validateInsideData(Pipe<S> pipe, int value) { int mHead = Pipe.blobMask(pipe) & Pipe.getBlobHeadPosition(pipe); int mTail = Pipe.blobMask(pipe) & Pipe.getBlobTailPosition(pipe); int mValue = Pipe.blobMask(pipe) & value; if (mTail<=mHead) { assert(mTail<=mValue && mValue<=mHead) : "tail "+mTail+" readBase "+mValue+" head "+mHead; return mTail<=mValue && mValue<=mHead; } else { assert(mValue<=mHead || mValue>=mTail) : "tail "+mTail+" readBase "+mValue+" head "+mHead; return mValue<=mHead || mValue>=mTail; } }
private static <S extends MessageSchema<S>> boolean validateInsideData(Pipe<S> pipe, int value) { int mHead = Pipe.blobMask(pipe) & Pipe.getBlobHeadPosition(pipe); int mTail = Pipe.blobMask(pipe) & Pipe.getBlobTailPosition(pipe); int mValue = Pipe.blobMask(pipe) & value; if (mTail<=mHead) { assert(mTail<=mValue && mValue<=mHead) : "tail "+mTail+" readBase "+mValue+" head "+mHead; return mTail<=mValue && mValue<=mHead; } else { assert(mValue<=mHead || mValue>=mTail) : "tail "+mTail+" readBase "+mValue+" head "+mHead; return mValue<=mHead || mValue>=mTail; } }
public LittleEndianDataInputBlobReader(Pipe<S> pipe) { this.pipe = pipe; this.backing = Pipe.blob(pipe); this.byteMask = Pipe.blobMask(pipe); this.workspace = new StringBuilder(64); }
public LittleEndianDataInputBlobReader(Pipe<S> pipe) { this.pipe = pipe; this.backing = Pipe.blob(pipe); this.byteMask = Pipe.blobMask(pipe); this.workspace = new StringBuilder(64); }
public LittleEndianDataOutputBlobWriter(Pipe<S> p) { this.p = p; this.byteBuffer = Pipe.blob(p); this.byteMask = Pipe.blobMask(p); assert(byteMask!=0); }
public LittleEndianDataOutputBlobWriter(Pipe<S> p) { this.p = p; this.byteBuffer = Pipe.blob(p); this.byteMask = Pipe.blobMask(p); assert(byteMask!=0); }
public LittleEndianDataOutputBlobWriter(Pipe<S> p) { this.p = p; this.byteBuffer = Pipe.blob(p); this.byteMask = Pipe.blobMask(p); assert(byteMask!=0); }
public DataInputBlobReader(Pipe<S> pipe) { super(); this.pipe = pipe; this.backing = Pipe.blob(pipe); this.byteMask = Pipe.blobMask(pipe); this.workspace = new StringBuilder(64); assert(this.backing!=null) : "The pipe must be init before use."; structuredReader = new StructuredReader(this); }
private final int methodLookup(Pipe<MessageSubscription> p, final int len, final int pos) { int result = (int)TrieParserReader.query(methodReader, methodLookup, Pipe.blob(p), pos, len, Pipe.blobMask(p)); assert(result!=-1) : "requested method was not found in: "+methodReader.debugAsUTF8(methodReader, new StringBuilder()); return result; }
public DataOutputBlobWriter(Pipe<S> p) { this.backingPipe = p; assert(null!=p) : "requires non null pipe"; assert(Pipe.isInit(p)): "The pipe must be init before use."; this.byteBuffer = Pipe.blob(p); this.byteMask = Pipe.blobMask(p); assert(this.byteMask!=0): "mask is "+p.blobMask+" size of blob is "+p.sizeOfBlobRing; this.structuredWriter = new StructuredWriter(this); }
/** * Read from InputStream and write the bytes to the var len field. * @param pipe data is written into * @param inputStream InputStream to read data from * @param byteCount of bytes to be read * @return true if the input stream is read * @throws IOException */ public static boolean readFieldFromInputStream(Pipe pipe, InputStream inputStream, final int byteCount) throws IOException { return buildFieldFromInputStream(pipe, inputStream, byteCount, Pipe.getWorkingBlobHeadPosition(pipe), Pipe.blobMask(pipe), Pipe.blob(pipe), pipe.sizeOfBlobRing); }
public DataOutputBlobWriter(Pipe<S> p) { this.backingPipe = p; assert(null!=p) : "requires non null pipe"; assert(Pipe.isInit(p)): "The pipe must be init before use."; this.byteBuffer = Pipe.blob(p); this.byteMask = Pipe.blobMask(p); assert(this.byteMask!=0): "mask is "+p.blobMask+" size of blob is "+p.sizeOfBlobRing; this.structuredWriter = new StructuredWriter(this); }
/** * Read from InputStream and write the bytes to the var len field. * @param pipe data is written into * @param inputStream InputStream to read data from * @param byteCount of bytes to be read * @return true if the input stream is read * @throws IOException */ public static boolean readFieldFromInputStream(Pipe pipe, InputStream inputStream, final int byteCount) throws IOException { return buildFieldFromInputStream(pipe, inputStream, byteCount, Pipe.getWorkingBlobHeadPosition(pipe), Pipe.blobMask(pipe), Pipe.blob(pipe), pipe.sizeOfBlobRing); }
public static void readFieldIntoDataOutput(int loc, Pipe pipe, DataOutput out) throws IOException { int length = readBytesLength(pipe, loc); if (length>0) { int off = readBytesPosition(pipe, loc) & Pipe.blobMask(pipe); copyFieldToDataOutput(out, length, readBytesBackingArray(pipe, loc), off, pipe.sizeOfBlobRing-off); } }
public static long query(TrieParserReader trieReader, TrieParser trie, Pipe<?> input, final long unfoundResult) { int meta = Pipe.takeByteArrayMetaData(input); int length = Pipe.takeByteArrayLength(input); return query(trieReader, trie, Pipe.byteBackingArray(meta, input), Pipe.bytePosition(meta, input, length), length, Pipe.blobMask(input), unfoundResult ); }
public static void parseSetup(TrieParserReader trieReader, Pipe<?> input) { //TODO: cofirm this field is next... int meta = Pipe.takeByteArrayMetaData(input); int length = Pipe.takeByteArrayLength(input); parseSetup(trieReader, Pipe.byteBackingArray(meta, input), Pipe.bytePosition(meta, input, length), length, Pipe.blobMask(input)); }
public static long query(TrieParserReader trieReader, TrieParser trie, Pipe<?> input, final long unfoundResult) { int meta = Pipe.takeByteArrayMetaData(input); int length = Pipe.takeByteArrayLength(input); return query(trieReader, trie, Pipe.byteBackingArray(meta, input), Pipe.bytePosition(meta, input, length), length, Pipe.blobMask(input), unfoundResult ); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }