com.emc.mongoose.base.item.io.NewItemInput 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.DataItemFactory;
import com.emc.mongoose.base.item.Item;
import com.emc.mongoose.base.item.ItemFactory;
import com.emc.mongoose.base.item.naming.ItemNameInput;
import com.github.akurilov.commons.io.Input;
import java.io.IOException;
import java.util.List;
/** Created by andrey on 01.12.16. */
public class NewItemInput implements Input {
protected final ItemFactory itemFactory;
protected final ItemNameInput itemNameInput;
public NewItemInput(final ItemFactory itemFactory, final ItemNameInput itemNameInput) {
this.itemFactory = itemFactory;
this.itemNameInput = itemNameInput;
}
@Override
public I get() {
return itemFactory.getItem(itemNameInput.get());
}
@Override
public int get(final List buffer, final int maxCount) {
for (var i = 0; i < maxCount; i++) {
buffer.add(itemFactory.getItem(itemNameInput.get()));
}
return maxCount;
}
/**
* Skips the specified count of the new item ids
*
* @param itemsCount count of items which should be skipped from the beginning
* @throws IOException doesn't throw
*/
@Override
public final long skip(final long itemsCount) {
return itemNameInput.skip(itemsCount);
}
@Override
public final void reset() {
itemNameInput.reset();
}
@Override
public final void close() throws Exception {
itemNameInput.close();
}
@Override
public String toString() {
return "New" + (itemFactory instanceof DataItemFactory ? "Data" : "") + "Items";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy