Anjum
Anjum

Reputation: 39

Reading Blob object holding sequence file

I need to read sequence file from gcs, i have blob object and reading logic for sequence file(i am able to read the sequence file with passing path ),but from blob.content how can i get the object of FSDataInputStream which should be type of Seekable so that i can pass it to Sequence reader, my code looks like this

byte[] blobContent = blob.getContent();

                    InputStream inputStream = new ByteArrayInputStream(blobContent);
                    
                    Configuration config = new Configuration();

                    FSDataInputStream fsDataInputStream = new FSDataInputStream(inputStream);

                    SequenceFile.Reader reader = new SequenceFile.Reader(config, SequenceFile.Reader.stream(fsDataInputStream));

With above code getting error -

java.lang.IllegalArgumentException: java.io.ByteArrayInputStream is not an instance of Seekable or PositionedReadable

Upvotes: 0

Views: 35

Answers (0)

Related Questions