Package org.exist.storage.io

Examples of org.exist.storage.io.VariableByteArrayInput


                        lock.acquire(Lock.WRITE_LOCK);
                        final Value value = dbTokens.get(key);
                        if (value == null)
                            {continue;}
                        //Add its data to the new list
                        final VariableByteArrayInput is = new VariableByteArrayInput(value.getData());
                        while (is.available() > 0) {
                            final int storedDocId = is.readInt();
                            final byte storedSection = is.readByte();
                            final int termCount = is.readInt();
                            //Read (variable) length of node IDs + frequency + offsets
                            final int length = is.readFixedInt();
                            if (storedSection != currentSection || storedDocId != this.doc.getDocId()) {
                                // data are related to another section or document:
                                // append them to any existing data
                                os.writeInt(storedDocId);
                                os.writeByte(storedSection);
                                os.writeInt(termCount);
                                os.writeFixedInt(length);
                                is.copyRaw(os, length);
                            } else {
                                // data are related to our section and document:
                                // feed the new list with the GIDs
                                NodeId previous = null;
                                for (int m = 0; m < termCount; m++) {
                                    NodeId nodeId = broker.getBrokerPool()
                                        .getNodeFactory().createFromStream(previous, is);
                                    previous = nodeId;
                                    final int freq = is.readInt();
                                    // add the node to the new list if it is not
                                    // in the list of removed nodes
                                    if (!storedOccurencesList.contains(nodeId)) {
                                        for (int n = 0; n < freq; n++) {
                                            newOccurencesList.add(nodeId, is.readInt());
                                        }
                                    } else {
                                        is.skip(freq);
                                    }
                                }
                            }
                        }
                        //append the data from the new list
View Full Code Here


                    //Does the value already has data in the index ?
                    if( value != null ) {

                        //Add its data to the new list
                        final VariableByteArrayInput is = new VariableByteArrayInput( value.getData() );

                        while( is.available() > 0 ) {
                            final int storedDocId = is.readInt();
                            final int gidsCount   = is.readInt();
                            final int size        = is.readFixedInt();

                            if( storedDocId != this.doc.getDocId() ) {

                                // data are related to another document:
                                // append them to any existing data
                                os.writeInt( storedDocId );
                                os.writeInt( gidsCount );
                                os.writeFixedInt( size );
                                is.copyRaw( os, size );
                            } else {

                                // data are related to our document:
                                // feed the new list with the GIDs
                                NodeId previous = null;
View Full Code Here

                    final Value value = dbValues.get( v );

                    if( value == null ) {
                        continue;
                    }
                    final VariableByteArrayInput is      = new VariableByteArrayInput( value.getData() );
                    boolean                changed = false;
                    os.clear();

                    while( is.available() > 0 ) {
                        final int storedDocId = is.readInt();
                        final int gidsCount   = is.readInt();
                        final int size        = is.readFixedInt();

                        if( storedDocId != document.getDocId() ) {

                            // data are related to another document:
                            // copy them (keep them)
                            os.writeInt( storedDocId );
                            os.writeInt( gidsCount );
                            os.writeFixedInt( size );
                            is.copyRaw( os, size );
                        } else {

                            // data are related to our document:
                            // skip them (remove them)
                            is.skipBytes( size );
                            changed = true;
                        }
                    }

                    //Store new data, if relevant
View Full Code Here

TOP

Related Classes of org.exist.storage.io.VariableByteArrayInput

Copyright © 2018 www.massapicom. 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.