Read a nested table. Instantiates the supplied reader class to
extract the data.

@param reader table reader class
@return table rows
5012
public List<MapRow> readTable(TableReader reader) throws IOException
   {
      reader.read();
      return reader.getRows();
   }
77104
public static ReadStreamOld openRead(Reader reader)
  {
    if (reader instanceof ReadStreamOld.StreamReader)
      return ((ReadStreamOld.StreamReader) reader).getStream();
    
    ReaderWriterStream s = new ReaderWriterStream(reader, null);
    ReadStreamOld is = new ReadStreamOld(s);
    try {
      is.setEncoding("utf-8");
    } catch (Exception e) {
    }

    return is;
  }
674615
public static List<String> readLines(Reader reader) throws IOException {
        IteratorClosureAdapter<String> closure = new IteratorClosureAdapter<String>(reader);
        eachLine(reader, closure);
        return closure.asList();
    }
218097
public StreamReader getTableData(String name) throws IOException
   {
      InputStream stream = new ByteArrayInputStream(m_tableData.get(name));
      if (m_majorVersion > 5)
      {        
         byte[] header = new byte[24];
         stream.read(header);
         SynchroLogger.log("TABLE HEADER", header);
      }
      return new StreamReader(m_majorVersion, stream);
   }
332277
public List<Process> read(final Reader reader) throws SAXException,
                                                 IOException {
        this.processes = ((ProcessBuildData) this.parser.read( reader )).getProcesses();
        return this.processes;
    }
576430
public void extract(@NotNull final SequentialReader reader, @NotNull final Metadata metadata)
    {
        HuffmanTablesDirectory directory = metadata.getFirstDirectoryOfType(HuffmanTablesDirectory.class);
        if (directory == null) {
            directory = new HuffmanTablesDirectory();
            metadata.addDirectory(directory);
        }

        try {
            while (reader.available() > 0) {
                byte header = reader.getByte();
                HuffmanTableClass tableClass = HuffmanTableClass.typeOf((header & 0xF0) >> 4);
                int tableDestinationId = header & 0xF;

                byte[] lBytes = getBytes(reader, 16);
                int vCount = 0;
                for (byte b : lBytes) {
                    vCount += (b & 0xFF);
                }
                byte[] vBytes = getBytes(reader, vCount);
                directory.getTables().add(new HuffmanTable(tableClass, tableDestinationId, lBytes, vBytes));
            }
        } catch (IOException me) {
            directory.addError(me.getMessage());
        }

        directory.setInt(HuffmanTablesDirectory.TAG_NUMBER_OF_TABLES, directory.getTables().size());
    }
1057349
public Set<Triple> getTriplesForObject(DOReader reader)
            throws ResourceIndexException {

        Set<Triple> objectTriples = new HashSet<Triple>();

        try {
            for (String modelRelobject:reader.getContentModels()){

                if (m_generators.containsKey(modelRelobject)) {
                    objectTriples.addAll(m_generators.get(modelRelobject)
                            .getTriplesForObject(reader));
                }
            }
        } catch (ServerException e) {
            throw new ResourceIndexException("Could not read object's content model",
                                             e);
        }

        return objectTriples;
    }
1087743
private static List<Object> readerToList(JsonReader reader) throws IOException {
    // todo: try to infer the type of the List?
    List<Object> list = new ArrayList<Object>();
    reader.beginArray();
    while (reader.hasNext()) {
      list.add(readValue(reader));
    }
    reader.endArray();
    return list;
  }
673728
public V deserialize( JsonReader reader, JsonDeserializationContext ctx ) {
        return getDeserializer().deserialize( reader, ctx, getParameters() );
    }
770754
final function FetchFromReader(DBInterfaces\IDatabaseReader $reader)
    {
        $objects = array();
        while($reader->Read())
        {
            $object = $this->CreateInstance($reader->ByName($this->KeyField()));
            $object->InitFromReader($reader);
            $objects[] = $object;
        }
        $reader->Close();
        return $objects;
    }
852565
private List<List<Writable>> filterRequiredColumns(String readerName, List<List<Writable>> list){

        //Options: (a) entire reader
        //(b) one or more subsets

        boolean entireReader = false;
        List<SubsetDetails> subsetList = null;
        int max = -1;
        int min = Integer.MAX_VALUE;
        for(List<SubsetDetails> sdList : Arrays.asList(inputs, outputs)) {
            for (SubsetDetails sd : sdList) {
                if (readerName.equals(sd.readerName)) {
                    if (sd.entireReader) {
                        entireReader = true;
                        break;
                    } else {
                        if (subsetList == null) {
                            subsetList = new ArrayList<>();
                        }
                        subsetList.add(sd);
                        max = Math.max(max, sd.subsetEndInclusive);
                        min = Math.min(min, sd.subsetStart);
                    }
                }
            }
        }

        if(entireReader){
            //No filtering required
            return list;
        } else if(subsetList == null){
            throw new IllegalStateException("Found no usages of reader: " + readerName);
        } else {
            //we need some - but not all - columns
            boolean[] req = new boolean[max+1];
            for(SubsetDetails sd : subsetList){
                for( int i=sd.subsetStart; i<= sd.subsetEndInclusive; i++ ){
                    req[i] = true;
                }
            }

            List<List<Writable>> out = new ArrayList<>();
            IntWritable zero = new IntWritable(0);
            for(List<Writable> l : list){
                List<Writable> lNew = new ArrayList<>(l.size());
                for(int i=0; i<l.size(); i++ ){
                    if(i >= req.length || !req[i]){
                        lNew.add(zero);
                    } else {
                        lNew.add(l.get(i));
                    }
                }
                out.add(lNew);
            }
            return out;
        }
    }
717093
public Map<Object, String> read(Reader reader) throws IOException {
        Map<Object, String> cvs = new HashMap<>();
        try (CSVReader r = new CSVReader(reader, '\t')) {
            String[] cols;
            int i = 1;
            while ((cols = r.readNext()) != null) {
                switch (cols.length) {
                    case 0:
                        break;
                    case 1:
                        String col0 = cols[0];
                        if (col0.length() > 1) {
                            cvs.put(col0, "");
                        }
                        break;
                    case 2:
                        cvs.put(cols[1], cols[0]);
                        break;
                    default:
                        throw new IOException("Invalid mapping in line " + i + ": mapping has length " + cols.length);
                }
                i++;
            }
        }
        return cvs;
    }
212955
public ItemReader<Chunk<T>> getOrCreateReader()
   {
      Node node = childNode.getOrCreate("reader");
      ItemReader<Chunk<T>> reader = new ItemReaderImpl<Chunk<T>>(this, "reader", childNode, node);
      return reader;
   }
426121
private List<Attribute> getAttributes(XMLStreamReader reader) {
        List<Attribute> list = new ArrayList<Attribute>();
        for(int i=0; i<reader.getAttributeCount(); i++) {
            list.add(new Attribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i)));
        }
        return list;
    }
1101606
public static GTRPublicData read(final Reader reader) throws IOException {
        checkNotNull(reader);
        try {
            // todo:  may want to cache some of this for performance reasons
            JAXBContext context = JAXBContext.newInstance(GTRPublicData.class);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            URL schemaURL = GtrReader.class.getResource("/org/nmdp/ngs/gtr/xsd/GTRPublicData.xsd");
            Schema schema = schemaFactory.newSchema(schemaURL);
            unmarshaller.setSchema(schema);
            return (GTRPublicData) unmarshaller.unmarshal(reader);
        }
        catch (JAXBException | SAXException e) {
            throw new IOException("could not unmarshal GTRPublicData", e);
        }
    }
882628
public void readTable() {
    // [START bigtable_hw_scan_all_veneer]
    try {
      System.out.println("\nReading the entire table");
      Query query = Query.create(tableId);
      ServerStream<Row> rowStream = dataClient.readRows(query);
      for (Row r : rowStream) {
        System.out.println("Row Key: " + r.getKey().toStringUtf8());
        for (RowCell cell : r.getCells()) {
          System.out.printf(
              "Family: %s    Qualifier: %s    Value: %s%n",
              cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8());
        }
      }
    } catch (NotFoundException e) {
      System.err.println("Failed to read a non-existent table: " + e.getMessage());
    }
    // [END bigtable_hw_scan_all_veneer]
  }
199644
public static Properties loadProperties(Reader reader) {
        Properties prop = new Properties();
        try {
            prop.load(reader);
        } catch (IOException e) {
            throw E.ioException(e);
        } finally {
            IO.close(reader);
        }
        return prop;
    }