com.emc.mongoose.base.item.io.SingleItemOutput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-base Show documentation
Show all versions of mongoose-base Show documentation
Mongoose is a high-load storage performance testing tool
package com.emc.mongoose.base.item.io;
import com.emc.mongoose.base.item.Item;
import com.github.akurilov.commons.io.Input;
import com.github.akurilov.commons.io.Output;
import java.util.List;
/** Created by andrey on 28.04.16. */
public class SingleItemOutput implements Output {
private volatile T item = null;
@Override
public boolean put(final T item) {
this.item = item;
return true;
}
@Override
public final int put(final List buffer, final int from, final int to) {
item = buffer.size() > 0 ? null : buffer.get(to - 1);
return 1;
}
@Override
public final int put(final List buffer) {
item = buffer.size() > 0 ? buffer.get(buffer.size() - 1) : null;
return 1;
}
@Override
public final Input getInput() {
return new SingleItemInput<>(item);
}
@Override
public final void close() {
item = null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy