本文整理了Java中org.apache.hadoop.io.IOUtils.writeFully()
方法的一些代码示例,展示了IOUtils.writeFully()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.writeFully()
方法的具体详情如下:
包路径:org.apache.hadoop.io.IOUtils
类名称:IOUtils
方法名:writeFully
[英]Write a ByteBuffer to a FileChannel at a given offset, handling short writes.
[中]以给定偏移量将ByteBuffer写入文件通道,处理短写操作。
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
public void set(long newVal) throws IOException {
lazyOpen();
buf.clear();
buf.putLong(newVal);
buf.flip();
IOUtils.writeFully(ch, buf, 0);
value = newVal;
}
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
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 + ")");
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
public void set(long newVal) throws IOException {
lazyOpen();
buf.clear();
buf.putLong(newVal);
buf.flip();
IOUtils.writeFully(ch, buf, 0);
value = newVal;
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
public void set(long newVal) throws IOException {
lazyOpen();
buf.clear();
buf.putLong(newVal);
buf.flip();
IOUtils.writeFully(ch, buf, 0);
value = newVal;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
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 + ")");
}
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
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 + ")");
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
FileChannel fc = raf.getChannel();
ByteBuffer buf = ByteBuffer.wrap(input);
IOUtils.writeFully(fc, buf);
raf.seek(0);
raf.read(output);
IOUtils.writeFully(fc, buf, HALFWAY);
for (int i = 0; i < HALFWAY; i++) {
assertEquals(input[i], output[i]);
代码示例来源:origin: ch.cern.hadoop/hadoop-common
FileChannel fc = raf.getChannel();
ByteBuffer buf = ByteBuffer.wrap(input);
IOUtils.writeFully(fc, buf);
raf.seek(0);
raf.read(output);
IOUtils.writeFully(fc, buf, HALFWAY);
for (int i = 0; i < HALFWAY; i++) {
assertEquals(input[i], output[i]);
内容来源于网络,如有侵权,请联系作者删除!