Examples of FSTStruct


Examples of org.nustaq.offheap.structs.FSTStruct

    transient protected FSTStruct pointer;
    @NoAssist
    public int calcSumPointered() {
        if ( pointer == null )
            pointer = new FSTStruct();
        largeArrayPointer(pointer);
        int res = 0;
        final int max = largeArrayLen();
        for (int i = 0; i < max; i++) {
            res += pointer.getInt();
View Full Code Here

Examples of org.nustaq.offheap.structs.FSTStruct

    /**
     * write the contents of a given object
     */
    @Override
    public void writeObject(FSTObjectOutput out, Object toWrite, FSTClazzInfo clzInfo, FSTClazzInfo.FSTFieldInfo referencedBy, int streamPosition) throws IOException {
        FSTStruct str = (FSTStruct) toWrite;
        if ( ! str.isOffHeap() ) {
            str = str.toOffHeap();
        }
        int byteSize = str.getByteSize();
        out.writeInt(byteSize);
        if ( COMPRESS ) {
            long base = str.___offset;
            int intsiz = byteSize/4;
            for ( int i=0; i<intsiz;i++ ) {
                int value = str.getInt();
                value = (value << 1) ^ (value >> 31);
                str.___offset+=4;
                while ((value & 0xFFFFFF80) != 0L) {
                    out.writeByte((value & 0x7F) | 0x80);
                    value >>>= 7;
                }
                out.writeByte(value & 0x7F);
            }
            int remainder = byteSize&3;
            for ( int i = 0; i < remainder; i++) {
                byte aByte = str.getByte();
                out.writeByte(aByte);
                str.___offset++;
            }
            str.___offset = base;
        } else {
            byte b[] = new byte[byteSize]; // fixme: cache threadlocal
            str.getBase().getArr(str.getOffset(), b, 0, byteSize);
            out.write( b, 0, byteSize);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.