本文整理汇总了Java中io.github.htools.io.EOCException类的典型用法代码示例。如果您正苦于以下问题:Java EOCException类的具体用法?Java EOCException怎么用?Java EOCException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EOCException类属于io.github.htools.io包,在下文中一共展示了EOCException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOffset
import io.github.htools.io.EOCException; //导入依赖的package包/类
public long getOffset(int id) {
long offset = -1;
try {
int marker = getMarkerOffset(id);
int jumpindex = getJumpIndex(id);
residenttable.setOffset(marker);
offset = residenttable.readInt();
for (int i = 0; i < jumpindex; i++) {
offset += residenttable.readInt2();
}
//log.info("getOffset() marker %d jumpindex %d offset %d skip %d", marker, jumpindex, offset, getSkip(id));
} catch (EOCException ex) {
log.fatalexception(ex, "getOffset( %d ) residenttable %s", id, residenttable);
}
return offset;
}
示例2: softFillBuffer
import io.github.htools.io.EOCException; //导入依赖的package包/类
public boolean softFillBuffer() throws EOCException {
//log.info("softFillBuffer datain %s hasmore %b pos %d end %d", datain, hasmore, bufferpos, end);
if (datain != null) {
if (hasmore) {
try {
if (bufferpos != 0) {
shift();
//log.info("softFillBuffer shifted pos %d end %d", bufferpos, end);
}
datain.fillBuffer(this);
return true;
} catch (EOCException ex) {
//log.info("softFillBuffer exception");
hasmore = false;
this.eof = ex;
}
}
} else {
hasmore = false;
this.eof = new EOCException();
}
return false;
}
示例3: skipCIntArray
import io.github.htools.io.EOCException; //导入依赖的package包/类
public void skipCIntArray() throws EOCException {
int length = readCInt();
if (length == -1) {
return;
}
int mainlength = (length / 4) * 4;
for (int i = 0; i < mainlength; i += 4) {
checkIn(1);
int mask = buffer[bufferpos++];
skip(CIntArrayLength[mask]);
}
for (int i = mainlength; i < length; i++) {
skipCInt();
}
//log.info("%d", this.getOffset());
}
示例4: readSquaredIntArray3
import io.github.htools.io.EOCException; //导入依赖的package包/类
public int[][][] readSquaredIntArray3() throws EOCException {
int length = readCInt();
if (length == -1) {
return null;
}
if (length == 0) {
return new int[0][][];
}
int length2 = readCInt();
int length3 = readCInt();
int array[][][] = new int[length][length2][length3];
int input[] = readCIntArray();
int p = 0;
for (int d1 = 0; d1 < length; d1++) {
for (int d2 = 0; d2 < length2; d2++) {
for (int d3 = 0; d3 < length3; d3++) {
array[d1][d2][d3] = input[p++];
}
}
}
return array;
}
示例5: nextRecord
import io.github.htools.io.EOCException; //导入依赖的package包/类
public boolean nextRecord() {
try {
while (true) {
ByteSearchSection section = reader.readSectionStart(root.section);
if (validRecord(section)) {
root.emptyDataContainer();
section = root.readNode(section);
reader.movePast(section);
return true;
}
reader.movePast(section);
if (!reader.hasMore()) {
break;
}
}
} catch (EOCException ex) {
}
root.emptyDataContainer();
return false;
}
示例6: readStringUntil
import io.github.htools.io.EOCException; //导入依赖的package包/类
@Override
public String readStringUntil(ByteSearch needle) throws EOCException {
pos p = new pos(bufferpos);
ByteSearchPosition endpos = needle.findPos(buffer, p.pos, end);
while (p.endoffile == null && !endpos.found() || endpos.endreached) {
readStringFillBuffer(p);
endpos = needle.findPos(buffer, p.pos, end);
}
if (endpos.found()) {
p.s.append(ByteTools.toString(buffer, bufferpos, endpos.start));
bufferpos = endpos.end;
return p.s.toString();
}
bufferpos = end;
throw new EOCException("readStringUntil(%s)", needle.toString());
}
示例7: getOffset
import io.github.htools.io.EOCException; //导入依赖的package包/类
/**
* @param id
* @return the offset in the datafile of the record(group) that contains the
* record with the given ID.
*/
public long getOffset(int id) {
long offset = -1;
try {
int marker = getMarkerOffset(id);
int jumpindex = getJumpIndex(id);
residenttable.setOffset(marker);
offset = residenttable.readInt();
for (int i = 0; i < jumpindex; i++) {
offset += residenttable.readByte();
}
//log.info("getOffset() bucketindex %d marker %d jumpindex %d offset %d", bucketindex, marker, jumpindex, offset);
} catch (EOCException ex) {
log.fatalexception(ex, "getOffset( %d ) residenttable %s", id, residenttable);
}
return offset;
}
示例8: readString0
import io.github.htools.io.EOCException; //导入依赖的package包/类
public String readString0() throws EOCException {
checkIn(1);
int strend = bufferpos - 1;
StringBuilder sb = new StringBuilder();
do {
if (++strend >= end) {
sb.append(ByteTools.toString(buffer, bufferpos, strend));
bufferpos = strend;
fillBuffer();
strend = 0;
}
} while (buffer[strend] != 0);
String s = ByteTools.toString(buffer, bufferpos, strend);
bufferpos = strend + 1;
if (sb.length() > 0) {
return sb.append(s).toString();
}
return s;
}
示例9: fill
import io.github.htools.io.EOCException; //导入依赖的package包/类
public void fill() throws EOCException {
shift();
if (!hasmore) {
log.fatal("Trying to read past Ceiling (offset %d pos %d end %d ceiling %d)", offset, bufferpos, end, ceiling);
}
try {
if (reader.nextKeyValue()) {
BytesWritable currentValue = reader.getCurrentValue();
int read = currentValue.getLength();
while (end + read > buffer.length) {
this.setBufferSize(getBufferSize() * 2);
}
System.arraycopy(currentValue.getBytes(), 0, buffer, end, read);
setEnd(end + read);
return;
}
} catch (IOException ex) {
}
hasmore = false;
throw new EOCException();
}
示例10: skipCLongArray
import io.github.htools.io.EOCException; //导入依赖的package包/类
public void skipCLongArray() throws EOCException {
int length = readCInt();
if (length == -1) {
return;
}
int mainlength = (length / 4) * 4;
for (int i = 0; i < mainlength; i += 4) {
checkIn(1);
int mask = buffer[bufferpos++];
for (int s = i; s < i + 4; s++) {
int m = (mask >> ((s - i) * 2)) & 3;
if (m == 3) {
skipCLong();
} else {
skip(m + 1);
}
}
}
for (int i = mainlength; i < length; i++) {
skipCLong();
}
}
示例11: nextDocument
import io.github.htools.io.EOCException; //导入依赖的package包/类
private byte[] nextDocument() {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int needleposition = 0;
while (true) {
try {
int b = getDatafileIn().readByte();
if (b != endTag[needleposition]) { // check if we match needle
if (needleposition > 0) {
buffer.write(endTag, 0, needleposition);
needleposition = 0;
}
}
if (b == endTag[needleposition]) {
needleposition++;
if (needleposition >= endTag.length) {
byte[] result = buffer.toByteArray();
if (!redirect.exists(result))
return result;
else
return null;
}
} else {
buffer.write(b);
// if (needleposition == 0 && !fsin.hasMore()) { // see if we've passed the stop point:
// return false;
// }
}
} catch (EOCException ex) {
return null;
}
}
}
示例12: readUntilStart
import io.github.htools.io.EOCException; //导入依赖的package包/类
private boolean readUntilStart() throws IOException {
int needleposition = 0;
while (getDatafileIn().hasMore() && (getDatafileIn().getOffset() < this.getEnd() || needleposition > 0)) {
try {
int b = getDatafileIn().readByte();
if (b < 0) {
needleposition = 0;
} else {
if (b != startTag[needleposition]) { // check if we match needle
needleposition = 0;
}
if (b == startTag[needleposition]) {
needleposition++;
if (needleposition >= startTag.length) {
return true;
}
} else {
if (needleposition == 0 && !getDatafileIn().hasMore()) { // see if we've passed the stop point:
return false;
}
}
}
} catch (EOCException ex) {
return false;
}
}
return false;
}
示例13: readLongArray
import io.github.htools.io.EOCException; //导入依赖的package包/类
public long[] readLongArray() throws EOCException {
int length = readInt();
if (length == -1) {
return null;
}
long array[] = new long[length];
for (int i = 0; i < length; i++) {
array[i] = readLong();
}
return array;
}
示例14: readEntity
import io.github.htools.io.EOCException; //导入依赖的package包/类
private void readEntity() throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
entitywritable = new Content();
key.set(fsin.getOffset());
int match = 0;
while (true) {
try {
int b = fsin.readByte();
if (match > 0 && b != warcTag[match]) { // output falsely cached chars
buffer.write(warcTag, 0, match);
match = 0;
}
if (b == warcTag[match]) { // check if we're matching needle
match++;
if (match >= warcTag.length) {
break;
}
} else {
buffer.write(b);
}
} catch (EOCException ex) {
buffer.write(warcTag, 0, match);
break;
}
}
entitywritable.content = buffer.toByteArray();
}
示例15: readInt3
import io.github.htools.io.EOCException; //导入依赖的package包/类
public int readInt3() throws EOCException {
//log.info("readInt() bufferpos %d", bufferpos);
checkIn(3);
int ch1 = buffer[bufferpos++] & 0xFF;
int ch2 = buffer[bufferpos++] & 0xFF;
int ch3 = buffer[bufferpos++] & 0xFF;
int result = ((ch1 << 16) + (ch2 << 8) + (ch3));
return result;
}