com.emc.mongoose.common.io.bin.BinOutput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-common Show documentation
Show all versions of mongoose-common Show documentation
Mongoose is a high-load storage performance testing tool
The newest version!
package com.emc.mongoose.common.io.bin;
import com.emc.mongoose.common.io.Output;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.List;
/**
The data item output implementation serializing something into the specified stream
*/
public abstract class BinOutput
implements Output {
protected final ObjectOutputStream output;
protected BinOutput(final ObjectOutputStream output) {
this.output = output;
}
@Override
public boolean put(final T item)
throws IOException {
output.writeUnshared(item);
return true;
}
@Override
public int put(final List buffer, final int from, final int to)
throws IOException {
output.writeUnshared(
buffer
.subList(from, to)
.toArray(new Object[to - from])
);
return to - from;
}
@Override
public final int put(final List items)
throws IOException {
return put(items, 0, items.size());
}
@Override
public void close()
throws IOException {
output.close();
}
@Override
public String toString() {
return "binOutput<" + output + ">";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy