热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.hadoop.fs.FSDataInputStream.available()方法的使用及代码示例

本文整理了Java中org.apache.hadoop.fs.FSDataInputStream.available()方法的一些代码示例,展示了FSDat

本文整理了Java中org.apache.hadoop.fs.FSDataInputStream.available()方法的一些代码示例,展示了FSDataInputStream.available()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FSDataInputStream.available()方法的具体详情如下:
包路径:org.apache.hadoop.fs.FSDataInputStream
类名称:FSDataInputStream
方法名:available

FSDataInputStream.available介绍

暂无

代码示例

代码示例来源:origin: apache/flink

@Override
public int available() throws IOException {
return fsDataInputStream.available();
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public int available() throws IOException {
int avail = in.available();
if (pos + avail > end) {
avail = (int) (end - pos);
}
return avail;
}

代码示例来源:origin: apache/hbase

@Override
public int available() throws IOException {
try {
return in.available();
} catch (FileNotFoundException e) {
return tryOpen().available();
} catch (NullPointerException e) { // HDFS 1.x - DFSInputStream.getBlockAt()
return tryOpen().available();
} catch (AssertionError e) { // assert in HDFS 1.x - DFSInputStream.getBlockAt()
return tryOpen().available();
}
}

代码示例来源:origin: apache/hbase

private static byte [] readFile(final FileSystem fs, final Path path) throws IOException {
FSDataInputStream tmpIn = fs.open(path);
try {
byte [] rawData = new byte[tmpIn.available()];
tmpIn.readFully(rawData);
return rawData;
} finally {
tmpIn.close();
}
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public int available() throws IOException {
return datas.available() + super.available();
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public int available() throws IOException {
return datas.available() + super.available();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public synchronized int available() throws IOException {
readStart();
try {
return is.available();
}
finally {
readEnd();
}
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
* Load from a Hadoop filesystem.
* There's a check for data availability after the file is open, by
* raising an EOFException if stream.available == 0.
* This allows for a meaningful exception without the round trip overhead
* of a getFileStatus call before opening the file. It may be brittle
* against an FS stream which doesn't return a value here, but the
* standard filesystems all do.
* JSON parsing and mapping problems
* are converted to IOEs.
* @param fs filesystem
* @param path path
* @return a loaded object
* @throws IOException IO or JSON parse problems
*/
public T load(FileSystem fs, Path path) throws IOException {
try (FSDataInputStream dataInputStream = fs.open(path)) {
// throw an EOF exception if there is no data available.
if (dataInputStream.available() == 0) {
throw new EOFException("No data in " + path);
}
return fromJsonStream(dataInputStream);
} catch (JsonProcessingException e) {
throw new IOException(
String.format("Failed to read JSON file \"%s\": %s", path, e),
e);
}
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws IOException {
Configuration cOnf= new Configuration();
conf.addResource(new Path("/hadoop/projects/hadoop-1.0.4/conf/core-site.xml"));
conf.addResource(new Path("/hadoop/projects/hadoop-1.0.4/conf/hdfs-site.xml"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the file path...");
String filePath = br.readLine();
Path path = new Path(filePath);
FileSystem fs = path.getFileSystem(conf);
FSDataInputStream inputStream = fs.open(path);
System.out.println(inputStream.available());
fs.close();
}

代码示例来源:origin: apache/hive

private String readFully(Path file) throws IOException {
FSDataInputStream in = fs.open(file);
byte[] b = new byte[in.available()];
in.readFully(b);
in.close();
return new String(b);
}

代码示例来源:origin: apache/hbase

StringBuilder sb = new StringBuilder(tmpIn.available());
while (tmpIn.available() > 0) {
sb.append(tmpIn.readChar());

代码示例来源:origin: apache/hbase

available = this.inputStream.available();
if (available > 0 && available throw new EOFException("Available stream not enough for edit, " +
"inputStream.available()= " + this.inputStream.available() + ", " +
"entry size= " + size + " at offset = " + this.inputStream.getPos());

代码示例来源:origin: apache/hbase

assertTrue(in.available() > 0);
byte [] buffer = new byte [1024];
int read = in.read(buffer);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Override
public int available() throws IOException {
int avail = in.available();
if (pos + avail > end) {
avail = (int) (end - pos);
}
return avail;
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

@Override
public int available() throws IOException {
int avail = in.available();
if (pos + avail > end) {
avail = (int) (end - pos);
}
return avail;
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
public int available() throws IOException {
int avail = in.available();
if (pos + avail > end) {
avail = (int) (end - pos);
}
return avail;
}

代码示例来源:origin: co.cask.hbase/hbase

@Override
public int available() throws IOException {
try {
return in.available();
} catch (FileNotFoundException e) {
return tryOpen().available();
} catch (NullPointerException e) { // HDFS 1.x - DFSInputStream.getBlockAt()
return tryOpen().available();
} catch (AssertionError e) { // assert in HDFS 1.x - DFSInputStream.getBlockAt()
return tryOpen().available();
}
}

代码示例来源:origin: dremio/dremio-oss

@Override
public int available() throws IOException {
try {
return underlyingIs.available();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}

代码示例来源:origin: dremio/dremio-oss

@Override
public int available() throws IOException {
try{
return is.available();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}

代码示例来源:origin: org.apache.tajo/tajo-storage-common

public FSDataInputChannel(FSDataInputStream inputStream) throws IOException {
if (inputStream.getWrappedStream() instanceof ByteBufferReadable) {
this.isDirectRead = true;
} else {
/* LocalFileSystem, S3 does not support ByteBufferReadable */
this.channel = Channels.newChannel(inputStream);
}
this.inputStream = inputStream;
this.size = inputStream.getPos() + inputStream.available();
}

推荐阅读
author-avatar
g37112969
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有