title: CSVReader and InputStream
body: <p>I have created CSVReader and I am trying to read csv file from assets for that reason I should use InputStream. But my code below does not have inputstream constructor. Could anyone tell me how i could add or change something in code, so I can use inputstream.</p>
  
  <pre><code>public class CSVReader {
  
      private BufferedReader br;
  
      private boolean hasNext = true;
  
      private char separator;
  
      private char quotechar;
  
      private int skipLines;
  
      private boolean linesSkiped;
  
      public int linesCount = 0;
  
      public static final char DEFAULT_SEPARATOR = '|';
      public static final char DEFAULT_QUOTE_CHARACTER = '"';
      public static final int DEFAULT_SKIP_LINES = 0;
  
      public CSVReader(Reader reader) {
          this(reader, DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER,
              DEFAULT_SKIP_LINES);
      }
  
      public CSVReader(Reader reader, char separator, char quotechar, int line) {
          this.br = new BufferedReader(reader);
          this.separator = separator;
          this.quotechar = quotechar;
          this.skipLines = line;
      }
      public String[] readNext() throws IOException {
  
          String nextLine = getNextLine();
          return hasNext ? parseLine(nextLine) : null;
      }
  
      public String getNextLine() throws IOException {
          if (!this.linesSkiped) {
              for (int i = 0; i &lt; skipLines; i++) {
                  br.readLine();
              }
              this.linesSkiped = true;
          }
          String nextLine = br.readLine();
          if (nextLine == null) {
              hasNext = false;
          }
          return hasNext ? nextLine : null;
      }
  
  
      public List&lt;String[]&gt; readAll() throws IOException {
  
          List&lt;String[]&gt; allElements = new ArrayList&lt;String[]&gt;();
          while (hasNext) {
              String[] nextLineAsTokens = readNext();
              if (nextLineAsTokens != null)
                  allElements.add(nextLineAsTokens);
          }
          return allElements;
  
      }
  
      private String[] parseLine(String nextLine) throws IOException {
  
          if (nextLine == null) {
              return null;
          }
  
          List&lt;String&gt; tokensOnThisLine = new ArrayList&lt;String&gt;();
          StringBuffer sb = new StringBuffer();
          boolean inQuotes = false;
          do {
              if (inQuotes) {
                  // continuing a quoted section, reappend newline
                  sb.append("\n");
                  nextLine = getNextLine();
                  linesCount++;
                  if (nextLine == null)
  
                      break;
              }
              for (int i = 0; i &lt; nextLine.length(); i++) {
  
                  char c = nextLine.charAt(i);
                  if (c == quotechar) {
                      if( inQuotes  
                          &amp;&amp; nextLine.length() &gt; (i+1)  
                          &amp;&amp; nextLine.charAt(i+1) == quotechar ){ 
                          sb.append(nextLine.charAt(i+1));
                          i++;
                      }else{
                          inQuotes = !inQuotes;
                          if(i&gt;2 
                                  &amp;&amp; nextLine.charAt(i-1) != this.separator 
                                  &amp;&amp; nextLine.length()&gt;(i+1) &amp;&amp;
                                  nextLine.charAt(i+1) != this.separator 
                          ){
                              sb.append(c);
                          }
                      }
                  } else if (c == separator &amp;&amp; !inQuotes) {
                      tokensOnThisLine.add(sb.toString());
                      sb = new StringBuffer(); 
                  } else {
                      sb.append(c);
                  }
              }
          } while (inQuotes);
          tokensOnThisLine.add(sb.toString());
          return (String[]) tokensOnThisLine.toArray(new String[0]);
  
      }
  
      public void close() throws IOException{
          br.close();
      }
  
  }
  </code></pre>