Java Code Examples for org.apache.hadoop.io.IOUtils#writeFully()
The following examples show how to use
org.apache.hadoop.io.IOUtils#writeFully() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditLogFileOutputStream.java From hadoop with Apache License 2.0 | 6 votes |
private void preallocate() throws IOException { long position = fc.position(); long size = fc.size(); int bufSize = doubleBuf.getReadyBuf().getLength(); long need = bufSize - (size - position); if (need <= 0) { return; } long oldSize = size; long total = 0; long fillCapacity = fill.capacity(); while (need > 0) { fill.position(0); IOUtils.writeFully(fc, fill, size); need -= fillCapacity; size += fillCapacity; total += fillCapacity; } if(LOG.isDebugEnabled()) { LOG.debug("Preallocated " + total + " bytes at the end of " + "the edit log (offset " + oldSize + ")"); } }
Example 2
Source File: EditLogFileOutputStream.java From big-c with Apache License 2.0 | 6 votes |
private void preallocate() throws IOException { long position = fc.position(); long size = fc.size(); int bufSize = doubleBuf.getReadyBuf().getLength(); long need = bufSize - (size - position); if (need <= 0) { return; } long oldSize = size; long total = 0; long fillCapacity = fill.capacity(); while (need > 0) { fill.position(0); IOUtils.writeFully(fc, fill, size); need -= fillCapacity; size += fillCapacity; total += fillCapacity; } if(LOG.isDebugEnabled()) { LOG.debug("Preallocated " + total + " bytes at the end of " + "the edit log (offset " + oldSize + ")"); } }
Example 3
Source File: BestEffortLongFile.java From hadoop with Apache License 2.0 | 5 votes |
public void set(long newVal) throws IOException { lazyOpen(); buf.clear(); buf.putLong(newVal); buf.flip(); IOUtils.writeFully(ch, buf, 0); value = newVal; }
Example 4
Source File: BestEffortLongFile.java From big-c with Apache License 2.0 | 5 votes |
public void set(long newVal) throws IOException { lazyOpen(); buf.clear(); buf.putLong(newVal); buf.flip(); IOUtils.writeFully(ch, buf, 0); value = newVal; }