/** * This is so hashCode and equals can be called without changing this object. * * It will return a copy of the current data buffer if serialized has not been called previously. * Otherwise, this.data will be returned since the buffer is null and will not change. */ private ByteBuffer serializedSnapshot() { if (buffer != null) { return this.buffer.toByteBuffer(); } else { return ByteBuffer.wrap(this.data); } }
public ByteBuffer compress(IteratorSetting[] iterators) { UnsynchronizedBuffer.Writer out = new UnsynchronizedBuffer.Writer(iterators.length * 8); out.writeVInt(iterators.length); for (IteratorSetting is : iterators) { out.writeVInt(getSymbolID(is.getName())); out.writeVInt(getSymbolID(is.getIteratorClass())); out.writeVInt(is.getPriority()); Map<String,String> opts = is.getOptions(); out.writeVInt(opts.size()); for (Entry<String,String> entry : opts.entrySet()) { out.writeVInt(getSymbolID(entry.getKey())); out.writeVInt(getSymbolID(entry.getValue())); } } return out.toByteBuffer(); }
/** * This is so hashCode and equals can be called without changing this object. * * It will return a copy of the current data buffer if serialized has not been called previously. * Otherwise, this.data will be returned since the buffer is null and will not change. */ private ByteBuffer serializedSnapshot() { if (buffer != null) { return this.buffer.toByteBuffer(); } else { return ByteBuffer.wrap(this.data); } }
public ByteBuffer compress(IteratorSetting[] iterators) { UnsynchronizedBuffer.Writer out = new UnsynchronizedBuffer.Writer(iterators.length * 8); out.writeVInt(iterators.length); for (IteratorSetting is : iterators) { out.writeVInt(getSymbolID(is.getName())); out.writeVInt(getSymbolID(is.getIteratorClass())); out.writeVInt(is.getPriority()); Map<String,String> opts = is.getOptions(); out.writeVInt(opts.size()); for (Entry<String,String> entry : opts.entrySet()) { out.writeVInt(getSymbolID(entry.getKey())); out.writeVInt(getSymbolID(entry.getValue())); } } return out.toByteBuffer(); }