List of usage examples for org.apache.lucene.store DataOutput writeBytes
public void writeBytes(byte[] b, int length) throws IOException
From source file:it.agilelab.bigdata.spark.search.impl.BigChunksRAMOutputStream.java
License:Apache License
/** Copy the current contents of this buffer to the named output. */ public void writeTo(DataOutput out) throws IOException { flush();/* w w w . j a v a 2 s . c o m*/ final long end = file.length; long pos = 0; int buffer = 0; while (pos < end) { int length = BUFFER_SIZE; long nextPos = pos + length; if (nextPos > end) { // at the last buffer length = (int) (end - pos); } out.writeBytes(file.getBuffer(buffer++), length); pos = nextPos; } }