我真的不明白我如何创建这样的inputStream,它是Seekable和PositionedReadable ......
Resource resource = new ClassPathResource("somefile");
InputStream bla = resource.getInputStream();
FSDataInputStream inputStream = new FSDataInputStream (bla);
投掷FS线:
java.lang.IllegalArgumentException: In is not an instance of Seekable or PositionedReadable
我需要做嘲笑,这对我来说是一个阻碍。
答案 0 :(得分:4)
FSDataInputStream
构造函数(如下所示)在FSDataInputStream.java中定义,希望 InputStream
参数为 {{ 1}} instance
或 Seekable
PositionedReadable
希望 public FSDataInputStream(InputStream in) throws IOException
{
super(in);
if( !(in instanceof Seekable) || !(in instanceof PositionedReadable) ) {
throw new IllegalArgumentException(
"In is not an instance of Seekable or PositionedReadable");
}
}
帮助您。
solution
参考:accumulo