waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapStringArray.java
public static ErddapStringArray fromInputStream(InputStream inputStream, String charset) throws IOException {
        if (charset == null || charset.isEmpty()) {
            charset = CDM.UTF8;
        }
        InputStreamReader isr = new InputStreamReader(inputStream, charset);
        BufferedReader bufferedReader = new BufferedReader(isr);

        ErddapStringArray sa = new ErddapStringArray();
        for (String s; (s = bufferedReader.readLine()) != null; ) {
            sa.add(s);
        }

        // Do not call BufferedReader.close() here; that would close the underlying InputStream, which is the
        // responsibility of the client. This ought to be safe, as neither InputStreamReader nor BufferedReader hold any
        // resources that a call to close() would make free and which the garbage collector would not make free anyway.
        return sa;
    }
public static ErddapStringArray fromInputStream(InputStream inputStream, String charset) throws IOException {
        if (charset == null || charset.isEmpty()) {
            charset = CDM.UTF8;
        }
        InputStreamReader isr = new InputStreamReader(inputStream, charset);
        BufferedReader bufferedReader = new BufferedReader(isr);

        ErddapStringArray sa = new ErddapStringArray();
        for (String s; (s = bufferedReader.readLine()) != null; ) {
            sa.add(s);
        }

        // Do not call BufferedReader.close() here; that would close the underlying InputStream, which is the
        // responsibility of the client. This ought to be safe, as neither InputStreamReader nor BufferedReader hold any
        // resources that a call to close() would make free and which the garbage collector would not make free anyway.
        return sa;
    }
public static ErddapStringArray fromInputStream ( InputStream inputStream , String charset ) throws IOException { if ( charset == null || charset . isEmpty ( ) ) { charset = CDM . UTF8 ; } InputStreamReader isr = new InputStreamReader ( inputStream , charset ) ; BufferedReader bufferedReader = new BufferedReader ( isr ) ; ErddapStringArray sa = new ErddapStringArray ( ) ; for ( String s ; ( s = bufferedReader . readLine ( ) ) != null ; ) { sa . add ( s ) ; } // Do not call BufferedReader.close() here; that would close the underlying InputStream, which is the // responsibility of the client. This ought to be safe, as neither InputStreamReader nor BufferedReader hold any // resources that a call to close() would make free and which the garbage collector would not make free anyway. return sa ; }
Reads the contents of {@code inputStream} into a StringArray. Each line of input will result in an element in
the array.
<p/>
The specified stream remains open after this method returns.

@param inputStream  a stream with line-based content.
@param charset      the name of a supported {@link java.nio.charset.Charset charset}.
@return  a StringArray created from the stream.
@throws IOException  if an I/O error occurs
Reads the contents of { @code inputStream } into a StringArray . Each line of input will result in an element in the array . <p / > The specified stream remains open after this method returns .