/** * Pad the list with entries. * * @param toIndex * index position to stop filling at. 0 inserts no filler. 1 * ensures the list has a size of 1, adding <code>val</code> if * the list is currently empty. * @param val * value to insert into padded positions. */ public void fillTo(int toIndex, long val) { while (count < toIndex) add(val); }
/** * Assign an entry in the list. * * @param index * index to set, must be in the range [0, {@link #size()}). * @param n * value to store at the position. */ public void set(int index, long n) { if (count < index) throw new ArrayIndexOutOfBoundsException(index); else if (count == index) add(n); else entries[index] = n; }
void addBlock(long pos) { if (!blockPos.contains(pos)) { blockPos.add(pos); } } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (readLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (initLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } } }
@Nullable LongList readBlockPositionList() { int n = valueType & VALUE_TYPE_MASK; if (n == 0) { n = readVarint32(); if (n == 0) { return null; } } LongList b = new LongList(n); b.add(readVarint64()); for (int j = 1; j < n; j++) { long prior = b.get(j - 1); b.add(prior + readVarint64()); } return b; }
/** * Pad the list with entries. * * @param toIndex * index position to stop filling at. 0 inserts no filler. 1 * ensures the list has a size of 1, adding <code>val</code> if * the list is currently empty. * @param val * value to insert into padded positions. */ public void fillTo(int toIndex, final long val) { while (count < toIndex) add(val); }
/** * Pad the list with entries. * * @param toIndex * index position to stop filling at. 0 inserts no filler. 1 * ensures the list has a size of 1, adding <code>val</code> if * the list is currently empty. * @param val * value to insert into padded positions. */ public void fillTo(int toIndex, long val) { while (count < toIndex) add(val); }
/** * Assign an entry in the list. * * @param index * index to set, must be in the range [0, {@link #size()}). * @param n * value to store at the position. */ public void set(final int index, final long n) { if (count < index) throw new ArrayIndexOutOfBoundsException(index); else if (count == index) add(n); else entries[index] = n; }
/** * Assign an entry in the list. * * @param index * index to set, must be in the range [0, {@link #size()}). * @param n * value to store at the position. */ public void set(int index, long n) { if (count < index) throw new ArrayIndexOutOfBoundsException(index); else if (count == index) add(n); else entries[index] = n; }
private void endOneObject() throws DhtException { if (currFragments != null) endFragmentedObject(); objChunkPtrs.add(currChunkPtr); }
private void endOneObject() throws DhtException { if (currFragments != null) endFragmentedObject(); objChunkPtrs.add(currChunkPtr); }
void addBlock(long pos) { if (!blockPos.contains(pos)) { blockPos.add(pos); } } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (readLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (readLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (initLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } } }
private void setCorrupt(long offset) { LongList list = corruptObjects; if (list == null) { synchronized (initLock) { list = corruptObjects; if (list == null) { list = new LongList(); corruptObjects = list; } } } synchronized (list) { list.add(offset); } } }
@Nullable LongList readBlockPositionList() { int n = valueType & VALUE_TYPE_MASK; if (n == 0) { n = readVarint32(); if (n == 0) { return null; } } LongList b = new LongList(n); b.add(readVarint64()); for (int j = 1; j < n; j++) { long prior = b.get(j - 1); b.add(prior + readVarint64()); } return b; }
@Override protected void onBeginWholeObject(long streamPosition, int type, long inflatedSize) throws IOException { ChunkFormatter w = begin(type); if (!w.whole(type, inflatedSize)) { endChunk(type); w = begin(type); if (!w.whole(type, inflatedSize)) throw panicCannotInsert(); } currType = type; currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(streamPosition); }
@Override protected void onBeginWholeObject(long streamPosition, int type, long inflatedSize) throws IOException { ChunkFormatter w = begin(type); if (!w.whole(type, inflatedSize)) { endChunk(type); w = begin(type); if (!w.whole(type, inflatedSize)) throw panicCannotInsert(); } currType = type; currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(streamPosition); }