code: public BinarySparseDataset parse(String name, InputStream stream) throws IOException, ParseException {
          try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
  
             BinarySparseDataset sparse = new BinarySparseDataset(name);
          
             String line = reader.readLine();
             if (line == null) {
                  throw new IOException("Empty data source.");
             }
          
             Set<Integer> items = new HashSet<>();
             do {
                  line = line.trim();
                  if (line.isEmpty()) {
                      continue;
                  }
  
                  String[] s = line.split("\\s+");
              
                  items.clear();
                  for (int i = 0; i < s.length; i++) {
                      items.add(Integer.parseInt(s[i]));
                  }
  
                  int j = 0;
                  int[] point = new int[items.size()];
                  for (int i : items) {
                      point[j++] = i;
                  }
  
                  Arrays.sort(point);
                  sparse.add(point);
                  line = reader.readLine();
              } while (line != null);
  
              return sparse;
          }
      }
docs: Parse a binary sparse dataset from an input stream.
  @param name the name of dataset.
  @param stream the input stream of data.
  @throws java.io.IOException