本文整理汇总了Java中io.github.htools.io.buffer.BufferReaderWriter类的典型用法代码示例。如果您正苦于以下问题:Java BufferReaderWriter类的具体用法?Java BufferReaderWriter怎么用?Java BufferReaderWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BufferReaderWriter类属于io.github.htools.io.buffer包,在下文中一共展示了BufferReaderWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
try {
int length = in.readInt();
byte b[] = new byte[length];
in.readFully(b);
BufferReaderWriter reader = new BufferReaderWriter(b);
type = Type.values()[ reader.readByte()];
partition = reader.readShort();
feature = reader.readByte();
termid = reader.readInt();
collectionid = reader.readString0();
} catch (EOCException ex) {
throw new IOException(ex);
}
}
示例2: fillBuffer
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
public void fillBuffer(BufferReaderWriter buffer) throws EOCException {
//log.info("readStringFillBuffer");
if (!buffer.hasMore()) {
log.fatal("Trying to read past Ceiling (offset %d pos %d end %d ceiling %d)", buffer.offset, buffer.bufferpos, buffer.end, buffer.ceiling);
}
int newread, maxread = buffer.readSpace();
int read = readBytes(buffer.offset + buffer.end, buffer.buffer, buffer.end, maxread);
//log.info("readStringFillBuffer() %s bufferoffset %d bufferpos %d bufferend %d ceiling %d maxread %d read %d",
// this.getFullPathName(), buffer.offset, buffer.bufferpos, buffer.end, buffer.ceiling, maxread, read);
if (read > 0) {
buffer.setEnd(buffer.end + read);
} else {
buffer.hasmore = false;
//log.info("EOF reached");
throw new EOCException();
}
}
示例3: fillBuffer
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void fillBuffer(BufferReaderWriter buffer) throws EOCException {
//log.info("readStringFillBuffer");
if (!buffer.hasMore()) {
log.fatal("Trying to read past Ceiling (offset %d pos %d end %d ceiling %d)", buffer.offset, buffer.bufferpos, buffer.end, buffer.ceiling);
}
int newread, maxread = buffer.readSpace();
int read = readBytes(buffer.offset + buffer.end, buffer.buffer, buffer.end, maxread);
//log.info("fillBuffer off %d end %d maxread %d read %d", buffer.offset, buffer.end, maxread, read);
if (read > 0) {
buffer.setEnd(buffer.end + read);
} else {
buffer.hasmore = false;
//log.info("EOF reached");
throw new EOCException();
}
}
示例4: flushBuffer
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void flushBuffer(BufferReaderWriter buffer) {
try {
if (buffer.buffer != null) {
//log.info("flushBuffer %d %d", buffer.getOffset() - buffer.bufferpos, buffer.getOffset());
fsout.write(buffer.buffer, 0, buffer.bufferpos);
buffer.offset += buffer.bufferpos;
buffer.bufferpos = 0;
if (buffer.getRequestedBufferSize() != buffer.getBufferSize()) {
buffer.resize(buffer.getRequestedBufferSize());
}
}
} catch (IOException ex) {
log.fatal(ex);
}
}
示例5: decode
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void decode(Document d, int reportid) {
try {
ArrayList<Occurrence> list = new ArrayList<Occurrence>();
BufferReaderWriter reader = new BufferReaderWriter((byte[]) d.reportdata[reportid]);
int size = reader.readCInt();
for (int i = 0; i < size; i++) {
Occurrence o = new Occurrence();
o.phrase = reader.readString();
o.span = reader.readCInt();
o.pos = reader.readCInt();
list.add(o);
}
d.reportdata[reportid] = list;
//log.info("decode doc %d reportid %d occ %d ist %d", d.docid, reportid, size, ((ArrayList<Occurrence>)d.reportdata[reportid]).size());
} catch (EOCException ex) {
log.fatalexception(ex, "valueReported(%s)", d);
}
}
示例6: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
set(reader.readString0());
value1 = reader.readLong();
value2 = reader.readLong();
}
示例7: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
hosts = reader.readStringArray();
partition = readKey(reader);
int listsize = reader.readInt();
list = new ArrayList<VALUE>();
for (int q = 0; q < listsize; q++) {
list.add(readValue(reader));
}
}
示例8: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
set(reader.readString0());
value2 = reader.readString0();
value3 = reader.readInt();
}
示例9: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
set(reader.readLong());
value2 = reader.readString0();
value3 = reader.readString0();
}
示例10: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
hosts = reader.readStringArray();
int listsize = reader.readInt();
list = new ArrayMap();
log.info("readFields %s %d", hosts, listsize);
for (int q = 0; q < listsize; q++) {
list.add(readKey(reader), readValue(reader));
}
}
示例11: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
set(reader.readString0());
value1 = reader.readString0();
value2 = reader.readInt();
value3 = reader.readInt();
isCandidate = reader.readBoolean();
}
示例12: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
BufferReaderWriter reader = new BufferReaderWriter(in);
set(reader.readString0());
value2 = reader.readInt();
value3 = reader.readInt();
}
示例13: readFields
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
@Override
public void readFields(BufferReaderWriter reader) {
value = reader.readString0();
value1 = reader.readLong();
value2 = reader.readInt();
value3 = reader.readInt();
isCandidate = reader.readBoolean();
}
示例14: fillBuffer
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
public void fillBuffer(BufferReaderWriter buffer) {
int read = readBytes(super.pos, buffer.buffer, buffer.end, buffer.buffer.length - buffer.end);
if (read == 0)
throw new EOCException();
else
buffer.end += read;
}
示例15: flushBuffer
import io.github.htools.io.buffer.BufferReaderWriter; //导入依赖的package包/类
public void flushBuffer(BufferReaderWriter buffer) {
//log.info("flushBuffer() %s %s offset %d length %d", outputstream, this.getFullPathName(), buffer.offset, buffer.bufferpos);
try {
outputstream.write(buffer.buffer, 0, buffer.bufferpos);
buffer.offset += buffer.bufferpos;
buffer.bufferpos = 0;
} catch (IOException ex) {
log.exception(ex, "flushBuffer( %s ) outputstream %s", buffer, outputstream);
}
}