Read abbr list.

@param dataFile the data file
@param map the map
@throws IOException Signals that an I/O exception has occurred.
546233
public static void readAbbrList(String dataFile, Map map) throws IOException {
		BufferedReader fin = new BufferedReader(new FileReader(dataFile));
		
		String line;
		while ((line = fin.readLine()) != null) {
		    StringTokenizer strTok = new StringTokenizer(line, " \t\r\n");
		    
		    if (strTok.countTokens() <= 0) {
			continue;
		    } 
		    
		    String token = strTok.nextToken();
		    
		    map.put(token.toLowerCase(), token.toLowerCase());
		}
    }
186757
public static Map<URI, Set<URI>> readMapFromXML(final File inputFile) throws IOException {
        final Map<URI, Set<URI>> graph = new HashMap<>();
        if (!inputFile.exists()) {
            return Collections.emptyMap();
        }
        final Properties prop = new Properties();
        try (FileInputStream in = new FileInputStream(inputFile)) {
            prop.loadFromXML(in);
        } catch (final IOException e) {
            throw new IOException("Failed to read subject scheme graph: " + e.getMessage(), e);
        }

        for (final Map.Entry<Object, Object> entry: prop.entrySet()) {
            final String key = (String) entry.getKey();
            final String value = (String) entry.getValue();
            final Set<URI> r = new HashSet<>();
            for (final String v: StringUtils.restoreSet(value, COMMA)) {
                r.add(toURI(v));
            }
            graph.put(toURI(key), r);
        }

        return Collections.unmodifiableMap(graph);
    }
1183599
protected ArrayList<HashMap> readDailyData(HashMap brMap, HashMap ret) throws IOException {

        ArrayList<HashMap> files = new ArrayList();
        ArrayList<HashMap<String, String>> daily;
        ArrayList titles;
        HashMap file;
        String line;
        BufferedReader brW;
        Object buf;
        HashMap mapW;
        LinkedHashMap formats = new LinkedHashMap();
        HashMap<String, ArrayList<HashMap<String, String>>> dailyById = new HashMap();
        String fileName;

        mapW = (HashMap) brMap.get("W");

        // If Weather File is no been found
        if (mapW.isEmpty()) {
            return files;
        }

        for (Object key : mapW.keySet()) {

            fileName = (String) key;
            if (fileName.lastIndexOf(".") > 0) {
                fileName = fileName.substring(0, fileName.lastIndexOf("."));
            }
            String wst_id;
            String clim_id;
            if (fileName.length() == 8 && !fileName.matches("\\w{4}\\d{4}$")) {
                wst_id = fileName;
                clim_id = fileName.substring(4);
            } else {
                wst_id = fileName.substring(0 ,4);
                clim_id = "0XXX";
            }
            
            buf = mapW.get(key);
            if (buf instanceof char[]) {
                brW = new BufferedReader(new CharArrayReader((char[]) buf));
            } else {
                brW = (BufferedReader) buf;
            }
            file = new HashMap();
            daily = new ArrayList();
            titles = new ArrayList();

            while ((line = brW.readLine()) != null) {

                // Get content type of line
                judgeContentType(line);

                // Read Weather File Info
                if (flg[0].equals("weather") && flg[1].equals("") && flg[2].equals("data")) {

                    // header info
                    file.put("wst_notes", line.replaceFirst("\\*[Ww][Ee][Aa][Tt][Hh][Ee][Rr]\\s*([Dd][Aa][Tt][Aa]\\s*)*:?", "").trim());

                } // Read Weather Data
                else if (flg[2].equals("data")) {

                    // Weather station info
                    if (flg[1].contains("insi ")) {

                        // Set variables' formats
                        formats.clear();
                        String[] names = flg[1].split("\\s+");
                        for (int i = 0; i < names.length; i++) {
                            if (names[i].equalsIgnoreCase("INSI")) {
                                formats.put("dssat_insi", 6);
                            } else if (names[i].equalsIgnoreCase("LAT")) {
                                formats.put("wst_lat", 9);
                            } else if (names[i].equalsIgnoreCase("LONG")) {
                                formats.put("wst_long", 9);
                            } else if (names[i].equalsIgnoreCase("ELEV")) {
                                formats.put("wst_elev", 6);
                            } else if (names[i].equalsIgnoreCase("TAV")) {
                                formats.put("tav", 6);
                            } else if (names[i].equalsIgnoreCase("AMP")) {
                                formats.put("tamp", 6);
                            } else if (names[i].equalsIgnoreCase("REFHT")) {
                                formats.put("refht", 6);
                            } else if (names[i].equalsIgnoreCase("WNDHT")) {
                                formats.put("wndht", 6);
                            } else if (names[i].equalsIgnoreCase("CO2")) {
                                formats.put("co2y", 6);
                            } else if (names[i].equalsIgnoreCase("CCO2")) {
                                formats.put("co2y", 6);
                            } else {
                                int end = flg[1].indexOf(names[i]) + names[i].length();
                                int start = 0;
                                if (i > 0) {
                                    start = flg[1].indexOf(names[i - 1]) + names[i - 1].length();
                                }
                                formats.put(names[i].toLowerCase(), end - start);
                            }
                        }

                        // Read line and save into return holder
                        file.putAll(readLine(line, formats));
                        // Check if the WST_ID inside file is matching with the file name
                        String dssat_insi = (String) file.get("dssat_insi");
                        if (dssat_insi == null || !wst_id.startsWith(dssat_insi)) {
                            LOG.warn("The name of weather file [{}] does not match with the INSI ({}) in the file.", key, dssat_insi);
                        }
//                        if (wst_name != null) {
//                            file.put("wst_name", fileName + " " + wst_name);
//                        } else {
//                            file.put("wst_name", fileName);
//                        }

                    } // Weather daily data
                    else if (flg[1].startsWith("date ")) {

                        // Set variables' formats
                        formats.clear();
                        formats.put("w_date", 5);
                        for (Object title : titles) {
                            formats.put(title, 6);
                        }
                        // Read line and save into return holder
                        HashMap tmp = readLine(line, formats);
                        // translate date from yyddd format to yyyymmdd format
                        translateDateStr(tmp, "w_date");
                        daily.add(tmp);

                    } else {
                    }
                } // Data Title Info
                else if (flg[2].equals("title")) {
                    // Dialy Data Title
                    if (flg[1].startsWith("date ")) {
                        for (int i = 6; i < line.length(); i += 6) {
                            String title = line.substring(i, Math.min(i + 6, line.length())).trim();
                            if (title.equalsIgnoreCase("DEWP")) {
                                titles.add("tdew");
                            } else if (title.equalsIgnoreCase("PAR")) {
                                titles.add("pard");
                            } else if (title.equalsIgnoreCase("VPRS")) {
                                titles.add("vprsd");
                            } else if (title.equalsIgnoreCase("RHUM")) {
                                titles.add("rhumd");
                            } else if (title.equals("")) {
                                titles.add("null" + i);
                            } else {
                                titles.add(title.toLowerCase());
                            }
                        }
                    } else {
                    }
//                } else if (flg[2].equals("comment")) {
//                    if (line.startsWith("!Climate ID: ")) {
//                        clim_id = line.substring(13).trim();
//                        if (clim_id.toUpperCase().equals("N/A")) {
//                            clim_id = "";
//                        }
//                    }
                } else {
                }
            }

            // Double check if the weather file name is following the old standard
            if (!daily.isEmpty() && wst_id.length() == 4) {
                String firstDay = daily.get(0).get("w_date");
                if (firstDay != null && firstDay.length() > 3) {
                    int year = 80;
                    try {
                        year = Integer.parseInt(firstDay.substring(2, 4));
                    } catch (NumberFormatException e) {
                    }
                    if (!fileName.startsWith(wst_id + String.format("%02d", year))) {
                        wst_id = fileName;
                        clim_id = fileName.substring(4);
                    }
                }
            }
            file.put("wst_name", wst_id);
            file.put("wst_id", wst_id);
            file.put("clim_id", clim_id);

            if (!dailyById.containsKey(wst_id)) {
                dailyById.put(wst_id, daily);
                file.put("wst_source", "DSSAT");
                file.put(dailyKey, daily);
                files.add(file);
            } else {
                ArrayList tmpArr = dailyById.get(wst_id);
//                tmpArr.addAll(daily);
                addDaily(tmpArr, daily);
            }
            brW.close();
        }
90003
public static void writeStringMap(DataOutputStream os, Map<String,String> map) throws IOException {
		if(map==null) {
			os.writeInt(-1);
		} else {
			Set<Entry<String, String>> es = map.entrySet();
			os.writeInt(es.size());
			for(Entry<String,String> e : es) {
				writeString(os, e.getKey());
				writeString(os, e.getValue());
			}
		}

	}
485149
private void read() throws IOException {
        lastModified = jobFile.lastModified();
        if (jobFile.exists()) {
            try (final InputStream in = new FileInputStream(jobFile)) {
                final XMLReader parser = XMLUtils.getXMLReader();
                parser.setContentHandler(new JobHandler(prop, files));

                parser.parse(new InputSource(in));
            } catch (final SAXException e) {
                throw new IOException("Failed to read job file: " + e.getMessage());
            }
        } else {
            // defaults
            prop.put(PROPERTY_GENERATE_COPY_OUTER, Generate.NOT_GENERATEOUTTER.toString());
            prop.put(PROPERTY_ONLY_TOPIC_IN_MAP, Boolean.toString(false));
            prop.put(PROPERTY_OUTER_CONTROL, OutterControl.WARN.toString());
        }
    }
362835
public static void map(ArchiveEntry entry, File file) throws IOException {
        create(entry).map(file);
    }
111408
public void readData(FieldTable table) throws DBException
    {
        if (this.getLookupKey() instanceof String)
        {
            try
            {
                FieldList record = table.getRecord();
                String strFilePath = (String)this.getLookupKey();
                String strFilePathName = this.getPDatabase().getFilename(strFilePath, false);
                File file = new File(strFilePathName);
                if (file.exists())
                {
                    XmlInOut inOut = new XmlInOut(null, null, null);
                    boolean bSuccess = inOut.importXML(((Record)record).getTable(), strFilePathName, null);
                    inOut.free();
                    if (!bSuccess)
                    {
                        // Ignore (for now)
                    }
                    this.fixCounter(table);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
960939
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {

        HashMap ret = new HashMap();
        ArrayList<HashMap> expArr = new ArrayList<HashMap>();
        HashMap<String, HashMap> files = readObvData(brMap);
//        compressData(file);
        ArrayList<HashMap> obvData;
        HashMap obv;
        HashMap expData;

        for (String exname : files.keySet()) {
            obvData = (ArrayList) files.get(exname).get(obvDataKey);
            for (HashMap obvSub : obvData) {
                expData = new HashMap();
                obv = new HashMap();
                copyItem(expData, files.get(exname), "exname");
                copyItem(expData, files.get(exname), "crid");
                copyItem(expData, files.get(exname), "local_name");
                expData.put(jsonKey, obv);
                obv.put(obvFileKey, obvSub.get(obvDataKey));
                expArr.add(expData);
            }
        }

        // remove index variables
        ArrayList idNames = new ArrayList();
        idNames.add("trno_t");
        removeIndex(expArr, idNames);
        ret.put("experiments", expArr);

        return ret;
    }
156549
public static void writeMapFile (BufferedWriter bout, HashMap<String, Integer> map)
        throws IOException
    {
        String[] lines = new String[map.size()];
        Iterator<String> iter = map.keySet().iterator();
        for (int ii = 0; iter.hasNext(); ii++) {
            String key = iter.next();
            Integer value = map.get(key);
            lines[ii] = key + SEP_STR + value;
        }
        QuickSort.sort(lines);
        for (String line : lines) {
            bout.write(line, 0, line.length());
            bout.newLine();
        }
        bout.flush();
    }
1255743
private Map<String, Map<String, String>> readSummaryFile(File outputFile) throws ExecutionException
  {
    List<String> algorithms = new ArrayList<String>();
    Map<String, Map<String, String>> filesHashcodes = new HashMap<String, Map<String, String>>();
    BufferedReader reader = null;
    try
    {
      reader = new BufferedReader(new FileReader(outputFile));
      String line;
      while ((line = reader.readLine()) != null)
      {
        // Read the CVS file header
        if (isFileHeader(line))
        {
          readFileHeader(line, algorithms);
        }
        else
        {
          // Read the dependencies checksums
          readDependenciesChecksums(line, algorithms, filesHashcodes);
        }
      }
    }
    catch (IOException e)
    {
      throw new ExecutionException(e.getMessage());
    }
    finally
    {
      IOUtil.close(reader);
    }

    return filesHashcodes;
  }
1165783
private Map<File, File[]> getDataMap_1_1(String[] dataDirs) {
		Map<File, File[]> map = new HashMap<File, File[]>();

		boolean doLog = false;
		if(!lockedMessages.contains("getDataMap")) {
			lockedMessages.add("getDataMap");
			doLog = true;
		}

		for (int i = 0; i < dataDirs.length; i++) {
			File dir = new File(dataDirs[i]);
			if (!dir.canRead()) {
				if(doLog) {
					logger.warn("Can't read: " + dir);
				}
				continue;
			}
			
			File[] ksList = dir.listFiles();
			for (int j = 0; j < ksList.length; j++) {

				if (ksList[j].isDirectory()) {
					File[] familyList = ksList[j].listFiles();
					
					for(int n = 0; n < familyList.length; n++) {
						if(familyList[n].isDirectory()) {
							ArrayList<File> snapshots = new ArrayList<File>();

							File snDir = new File(familyList[n], SNAPSHOTS_DIR_NAME);
							if (snDir.isDirectory()) {

								File[] snList = snDir.listFiles();

								for (int k = 0; k < snList.length; k++) {
									if (snList[k].isDirectory()) {
										snapshots.add(snList[k]);
									}
								}
							}

							map.put(familyList[n],
									snapshots.toArray(new File[snapshots.size()]));
							
						}						
					}					
				}
			}
		}
		
//		if(doLog) {
//			logger.debug("familiesCount=" + map.size());
//			
//			for(File f : map.keySet()) {
//				File[] snaps = map.get(f);
//				logger.debug("family: " + f.getAbsolutePath() + ",  snapshotsCount=" + snaps.length);
//	
//				for(int i = 0; i < snaps.length; i++) {
//					logger.debug("snaps[" + i + "]: " + snaps[i]);
//				}
//			}
//		}
		
		return map;
	}
1130032
public static Map<String, List<Object>> readDbf( String path ) throws IOException {

        OmsDbfTableReader reader = new OmsDbfTableReader();
        reader.file = path;
        reader.readTable();

        return reader.outTabledata;
    }
964624
def map_data(self, map_name):
    """"""
    with gfile.Open(os.path.join(self.data_dir, "Maps", map_name), "rb") as f:
      return f.read()
1307932
private void readMap(final Element map, final Map<String, KeyDef> keyDefs) {
        readKeyDefinition(map, keyDefs);
        for (final Element elem: getChildElements(map)) {
            if (!(SUBMAP.matches(elem) || elem.getAttributeNode(ATTRIBUTE_NAME_KEYSCOPE) != null)) {
                readMap(elem, keyDefs);
            }
        }
    }
605221
public void write(LineMap lineMap)
    throws IOException
  {
    _os.println("SMAP");
    _os.println(lineMap.getDestFilename());
    _os.println(_sourceType);
    _os.println("*S " + _sourceType);

    IntMap fileMap = new IntMap();

    _os.println("*F");
    Iterator<LineMap.Line> iter = lineMap.iterator();
    while (iter.hasNext()) {
      LineMap.Line line = iter.next();

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);
      if (index < 0) {
        index = fileMap.size() + 1;
        fileMap.put(filename, index);

        if (filename.indexOf('/') >= 0) {
          int p = filename.lastIndexOf('/');

          _os.println("+ " + index + " " + filename.substring(p + 1));
          // XXX: _os.println(filename);

          if (filename.startsWith("/"))
            _os.println(filename.substring(1));
          else
            _os.println(filename);
        }
        else
          _os.println(index + " " + filename);
      }
    }
    
    _os.println("*L");
    int size = lineMap.size();
    int lastIndex = 0;
    for (int i = 0; i < size; i++) {
      LineMap.Line line = lineMap.get(i);

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);

      String fileMarker = "";

      _os.print(line.getSourceLine());
      _os.print("#" + index);

      if (line.getRepeatCount() > 1)
        _os.print("," + line.getRepeatCount());

      _os.print(":");
      _os.print(line.getDestinationLine());
      if (line.getDestinationIncrement() > 1)
        _os.print("," + line.getDestinationIncrement());
      _os.println();
    }
    
    _os.println("*E");
  }
1088185
@Override
	public void open(FileInputSplit split) throws IOException {
		super.open(split);

		DatumReader<E> datumReader;
		if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(avroValueType)) {
			datumReader = new SpecificDatumReader<E>(avroValueType);
		} else {
			datumReader = new ReflectDatumReader<E>(avroValueType);
		}
		
		LOG.info("Opening split " + split);
		
		SeekableInput in = new FSDataInputStreamWrapper(stream, (int) split.getLength());
		
		dataFileReader = DataFileReader.openReader(in, datumReader);
		dataFileReader.sync(split.getStart());
	}
853695
public static HashMap<Integer, Integer> readIntIntMapFromGlob(Path glob, FileSystem fs)
	    throws IOException {
		FileStatus status[] = fs.globStatus(glob);
		HashMap<Integer, Integer> ret = new HashMap<Integer, Integer>();
		for(FileStatus fileS : status) {
			ret.putAll(readIntIntMap(fileS.getPath(), fs));
		}
		return ret;
	}