IO/NIO with Streams

Paul Sandoz paul.sandoz at oracle.com
Mon Feb 10 06:55:27 PST 2014


On Feb 9, 2014, at 3:20 PM, Mohan Radhakrishnan <radhakrishnan.mohan at gmail.com> wrote:

> Hi,
>       I have seen the File API being used with maps and filters. Is there
> a way to stream from a NIO channel like this into a ByteBuffer with
> filtering capabilities ?
> 

No. 

The support added to Files operates at a higher level, streaming over files in directory and streaming over lines parsed from a text file.

Paul.

> 
> try(
>            SeekableByteChannel skbc = Files.newByteChannel(p,
> 
> EnumSet.of(StandardOpenOption.READ))) {
> 
>            while( skbc.read( b ) > 0){
> 
>            }
> 
>        } catch (IOException e) {
>            e.printStackTrace();
>        }
> 
> Thanks.
> 



More information about the lambda-dev mailing list