I have a large file which I have connected to via a Java InputStream and I will later provide the InputStream to a function as a parameter.
InputStream inputStream = new FileInputStream( ... );
But I want my InputStream to be reduced / filtered to a subset of the row; my data is in the form:
X,Y
X,Y
X,Y
I want the InputStream to include only the second element in this csv file i.e. Y- I want row-based filtering on my stream.
I want to preserve memory when I do such transformations.
Maybe this representation will better explain my requirement:
inputStream -(filter on row)-> filteredInputStream
Then I will pass the filteredInputStream to my function as parameter.
What is the best practice way to do this? Shall I connect one stream to another to perform such filtering?