private static void readBytesRing(Pipe pipe, int len, byte[] target, int targetloc, int pos) { byte[] buffer = Pipe.blob(pipe); int mask = pipe.blobMask; while (--len >= 0) { target[targetloc++]=buffer[mask & pos++]; //TODO:M replace with dual arrayCopy as seen elsewhere } }
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); }
private static void readBytesRing(Pipe pipe, int len, byte[] target, int targetloc, int pos) { byte[] buffer = Pipe.blob(pipe); int mask = pipe.blobMask; while (--len >= 0) { target[targetloc++]=buffer[mask & pos++]; //TODO:M replace with dual arrayCopy as seen elsewhere } }
public LittleEndianDataInputBlobReader(Pipe<S> pipe) { this.pipe = pipe; this.backing = Pipe.blob(pipe); this.byteMask = Pipe.blobMask(pipe); this.workspace = new StringBuilder(64); }
private static void readASCIIRing(Pipe pipe, int len, char[] target, int targetloc, int pos) { byte[] buffer = Pipe.blob(pipe); int mask = pipe.blobMask; while (--len >= 0) { target[targetloc++]=(char)buffer[mask & pos++]; } }
public LittleEndianDataInputBlobReader(Pipe<S> pipe) { this.pipe = pipe; this.backing = Pipe.blob(pipe); this.byteMask = Pipe.blobMask(pipe); this.workspace = new StringBuilder(64); }
private static boolean eqASCIIRing(Pipe pipe, int len, CharSequence seq, int pos) { byte[] buffer = Pipe.blob(pipe); int mask = pipe.blobMask; int i = 0; while (--len >= 0) { if (seq.charAt(i++)!=buffer[mask & pos++]) { //System.err.println("text match failure on:"+seq.charAt(i-1)+" pos "+pos+" mask "+mask); return false; } } return true; }
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 static boolean eqASCIIRing(Pipe pipe, int len, CharSequence seq, int pos) { byte[] buffer = Pipe.blob(pipe); int mask = pipe.blobMask; int i = 0; while (--len >= 0) { if (seq.charAt(i++)!=buffer[mask & pos++]) { //System.err.println("text match failure on:"+seq.charAt(i-1)+" pos "+pos+" mask "+mask); return false; } } return true; }
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 static int readUTF8Ring(Pipe pipe, int bytesLen, char[] target, int targetloc, int ringPos) { long charAndPos = ((long)ringPos)<<32; long limit = ((long)(ringPos+bytesLen))<<32; int i = targetloc; while (charAndPos<limit) { charAndPos = Pipe.decodeUTF8Fast(Pipe.blob((Pipe<?>) pipe), charAndPos, pipe.blobMask); target[i++] = (char)charAndPos; } return i - targetloc; }
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; }
private static int readUTF8Ring(Pipe pipe, int bytesLen, char[] target, int targetloc, int ringPos) { long charAndPos = ((long)ringPos)<<32; long limit = ((long)(ringPos+bytesLen))<<32; int i = targetloc; while (charAndPos<limit) { charAndPos = Pipe.decodeUTF8Fast(Pipe.blob((Pipe<?>) pipe), charAndPos, pipe.blobMask); target[i++] = (char)charAndPos; } return i - targetloc; }
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); }
/** * Peeks at internal data; advanced feature */ public static byte[] peekDataBackingArray(Pipe pipe, int loc) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); int pos = Pipe.slab(pipe)[pipe.slabMask & (int)(pipe.ringWalker.nextWorkingTail+ (OFF_MASK&loc))]; return pos<0 ? pipe.blobConstBuffer : Pipe.blob(pipe); }
/** * 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 addLocalHeapValue(int heapId, int sourceLen, LocalHeap byteHeap, Pipe rbRingBuffer) { final int p = Pipe.getWorkingBlobHeadPosition((Pipe<?>) rbRingBuffer); if (sourceLen > 0) { final int offset = heapId << 2; final int pos = byteHeap.tat[offset]; final int len = byteHeap.tat[offset + 1] - pos; copyToRingBuffer(Pipe.blob((Pipe<?>) rbRingBuffer), p, rbRingBuffer.blobMask, pos, len, byteHeap.data); Pipe.addAndGetBlobWorkingHeadPosition(rbRingBuffer,len); } Pipe.addBytePosAndLen(rbRingBuffer, p, sourceLen); }
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); }
public static void addLocalHeapValue(int heapId, int sourceLen, LocalHeap byteHeap, Pipe rbRingBuffer) { final int p = Pipe.getWorkingBlobHeadPosition((Pipe<?>) rbRingBuffer); if (sourceLen > 0) { final int offset = heapId << 2; final int pos = byteHeap.tat[offset]; final int len = byteHeap.tat[offset + 1] - pos; copyToRingBuffer(Pipe.blob((Pipe<?>) rbRingBuffer), p, rbRingBuffer.blobMask, pos, len, byteHeap.data); Pipe.addAndGetBlobWorkingHeadPosition(rbRingBuffer,len); } Pipe.addBytePosAndLen(rbRingBuffer, p, sourceLen); }