當前位置: 首頁>>代碼示例>>Java>>正文


Java BufferReaderWriter類代碼示例

本文整理匯總了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);
   }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:17,代碼來源:RecordKey.java

示例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();
   }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:18,代碼來源:FSFileInBuffer.java

示例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();
    }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:19,代碼來源:ISDataIn.java

示例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);
    }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:18,代碼來源:HDFSOut.java

示例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);
   }
}
 
開發者ID:repir,項目名稱:repirproximity,代碼行數:20,代碼來源:AnalyzeDistanceFeature.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:8,代碼來源:TextLongLong.java

示例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));
   }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:12,代碼來源:MRInputSplit.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:8,代碼來源:TextTextInt.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:8,代碼來源:LongTextText.java

示例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));
   }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:12,代碼來源:KVInputSplit.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:10,代碼來源:TextTextIntIntBool.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:8,代碼來源:TextIntIntWritable.java

示例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();
}
 
開發者ID:htools,項目名稱:htools,代碼行數:9,代碼來源:TextLongIntIntBool.java

示例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;
}
 
開發者ID:htools,項目名稱:htools,代碼行數:8,代碼來源:BytesIn.java

示例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);
   }
}
 
開發者ID:htools,項目名稱:htools,代碼行數:11,代碼來源:FSFileOutBuffer.java


注:本文中的io.github.htools.io.buffer.BufferReaderWriter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。