Package org.exist.util

Examples of org.exist.util.FixedByteArray


            BrokerPool.FORCE_CORRUPTION = true;
           
            for (int i = 1; i < 1001; i++) {
                String value = "test" + i;
                byte[] data = value.getBytes(UTF_8);
                collectionsDb.put(txn, new Value(data), new FixedByteArray(data, 0, data.length), true);
            }
           
            byte[] replacement = "new value".getBytes(UTF_8);
            for (int i = 1; i < 101; i++) {
                String value = "test" + i;
                byte[] data = value.getBytes(UTF_8);
                collectionsDb.put(txn, new Value(data), new FixedByteArray(replacement, 0, replacement.length), true);
            }
            mgr.commit(txn);
           
            Writer writer = new StringWriter();
            collectionsDb.dump(writer);
View Full Code Here


            BrokerPool.FORCE_CORRUPTION = true;
           
            Value key = new Value("test".getBytes());
           
            byte[] data = "_HELLO_YOU_".getBytes();
            collectionsDb.put(txn, key, new FixedByteArray(data, 0, data.length), true);
           
            for (int i = 1; i < 101; i++) {
                String value = "_HELLO_" + i;
                data = value.getBytes(UTF_8);
                collectionsDb.append(txn, key, new FixedByteArray(data, 0, data.length));
            }
           
            mgr.commit(txn);
           
            // start a new transaction that will not be committed and thus undone
            txn = mgr.beginTransaction();           
           
            for (int i = 1001; i < 2001; i++) {
                String value = "_HELLO_" + i;
                data = value.getBytes(UTF_8);
                collectionsDb.append(txn, key, new FixedByteArray(data, 0, data.length));
            }
      
            collectionsDb.remove(txn, key);
           
            mgr.getJournal().flushToLog(true);
View Full Code Here

                    return UNKNOWN_ADDRESS;
                }
                final byte[] newData = new byte[l + valueLen];
                System.arraycopy(data, offset + 4, newData, 0, l);
                value.copyTo(newData, l);
                p = update(transaction, p, page, key, new FixedByteArray(newData, 0, newData.length));
            }
            return p;
        } catch (final BTreeException bte) {
            LOG.warn("btree exception while appending value", bte);
        }
View Full Code Here

    }

    public long put(Txn transaction, Value key, byte[] data, boolean overwrite)
            /* throws ReadOnlyException */ {
        SanityCheck.THROW_ASSERT(key.getLength() <= fileHeader.getWorkSize(), "Key length exceeds page size!");
        final FixedByteArray buf = new FixedByteArray(data, 0, data.length);
        return put(transaction, key, buf, overwrite);
    }
View Full Code Here

    }

    protected void undoRemoveValue(RemoveValueLoggable loggable) {
        try {
            final SinglePage page = getSinglePage(loggable.page, true);
            final FixedByteArray data = new FixedByteArray(loggable.oldData);
            storeValueHelper(null, loggable.tid, data, page);
        } catch (final IOException e) {
            LOG.warn("An IOException occurred during undo: " + e.getMessage(), e);
        }
    }
View Full Code Here

        page = in.getInt();
        tid = in.getShort();
        final int len = in.getShort();
        final byte[] data = new byte[len];
        in.get(data);
        value = new FixedByteArray(data, 0, len);
    }
View Full Code Here

        super.read(in);
        pageNum = in.getInt();
        chunkSize = in.getInt();
        final byte b[] = new byte[chunkSize];
        in.get(b);
        data = new FixedByteArray(b);
    }
View Full Code Here

TOP

Related Classes of org.exist.util.FixedByteArray

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.