Create a number of threads to generate read traffics
@param conf
@param key directory of files to read
@param value checksum file locaiton
@return
@throws IOException
509315
@Override
    public GenThread[] prepare(JobConf conf, Text key, Text value)
        throws IOException {
      this.rtc = new RunTimeConstants();
      super.prepare(conf, key, value, rtc);
      Path basePath = new Path(key.toString());
      LOG.info("base path is " + basePath);
      Path checksumPath = null;
      FileSystem fs = FileSystem.newInstance(conf);
      if (value.toString().length() != 0) {
        checksumPath = new Path(value.toString());
      }
      HashMap<String, Long> checksumMap = null;
      boolean verifyChecksum = false;
      if (fs.exists(checksumPath)) {
        LOG.info("checksum path is " + checksumPath);
        verifyChecksum = true;
        checksumMap = new HashMap<String, Long>();
        SequenceFile.Reader reader = null;
        try {
          reader = new SequenceFile.Reader(fs, checksumPath, conf);
          Writable dir = (Writable) ReflectionUtils.newInstance(
            reader.getKeyClass(), conf);
          Writable checksum = (Writable) ReflectionUtils.newInstance(
            reader.getValueClass(), conf);
          while(reader.next(dir, checksum)) {
            LOG.info("dir: " + dir.toString() + " checksum: " + checksum);
            checksumMap.put(
                fs.makeQualified(new Path(dir.toString())).toUri().getPath(),
                Long.parseLong(checksum.toString()));
          }
        } catch(Exception e) {
          LOG.error(e);
          throw new IOException(e);
        } finally {
          IOUtils.closeStream(reader);
        }
      }
      
      FileStatus[] baseDirs = fs.listStatus(basePath);
      if (rtc.nthreads != baseDirs.length) {
        throw new IOException("Number of directory under " + basePath + 
            "(" + baseDirs.length + ") doesn't match number of threads " + 
            "(" + rtc.nthreads + ").");
      }
      
      GenReaderThread[] threads = new GenReaderThread[(int)rtc.nthreads];

      for (int i=0; i < rtc.nthreads; i++) {
        long checksum = 0;
        if (verifyChecksum) {
          String basePathStr = baseDirs[i].getPath().toUri().getPath();
          checksum = checksumMap.get(basePathStr);
        }
        threads[i] = new GenReaderThread(conf, baseDirs[i].getPath(), 
            checksum, verifyChecksum, rtc);
      }
      return threads;
    }
396164
def apply(key, value):
    '''
    
    '''
    path = __opts__['conf_file']
    if os.path.isdir(path):
        path = os.path.join(path, 'master')
    data = values()
    data[key] = value
    with salt.utils.files.fopen(path, 'w+') as fp_:
        salt.utils.yaml.safe_dump(data, default_flow_style=False)
1104681
private Map<String, Object> _processConf(Map<String, ?> conf) {
        Map<String, Object> m = new HashMap<String, Object>(conf.size());
        for (String s : conf.keySet()) {
            Object o = conf.get(s);
            if (s.startsWith("rythm.")) s = s.replaceFirst("rythm\\.", "");
            m.put(s, o);
        }
        return m;
    }
330979
void writeObjectKeyValue(String key, String value) throws IOException {
        writeObjectKey(key);
        writeString(value);
    }
926892
public static HashMap<Integer, Integer> readIntIntMap(Path path, FileSystem fs)
	    throws IOException {
		SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, fs.getConf());

		IntWritable topic = new IntWritable();
		IntWritable value = new IntWritable();

		HashMap<Integer, Integer> ret = new HashMap<Integer, Integer>();

		while(reader.next(topic)) {
			reader.getCurrentValue(value);

			ret.put(topic.get(), value.get());
		}

		reader.close();
		return ret;
	}
1237761
static void copy(final Configuration conf, final Arguments args
      ) throws IOException {
    DistCopier copier = getCopier(conf, args);
    
    if (copier != null) {
      try {
        JobClient client = copier.getJobClient();
        RunningJob job = client.submitJob(copier.getJobConf());
        try {
          if (!client.monitorAndPrintJob(copier.getJobConf(), job)) {
            throw new IOException("Job failed!");
          }
        } catch (InterruptedException ie) {
          Thread.currentThread().interrupt();
        }
        copier.finalizeCopiedFiles();
      } finally {
        copier.cleanupJob();
      }
    }
  }
346759
public FileIndexBuilder putMetadata(String key, String value) {
        checkIfDestroyed();
        metadata.put(key, value);
        return this;
    }
362315
public static void writeInPemFormat(final PublicKey publicKey, final @NonNull File file)
		throws IOException
	{
		KeyWriter.writeInPemFormat(publicKey, file);
	}
293390
public void put( Object key, URLConnection conn )
    {
        synchronized( this ) // ensure no ConcurrentModificationException can occur.
        {
            Entry entry = new Entry( conn );
            m_hardStore.put( key, entry );
            if( m_thread == null )
            {
                m_thread = new Thread( this, "ConnectionCache-cleaner" );
                m_thread.setDaemon( true );
                m_thread.start();
            }
        }
    }
51625
@Override
	public void read(final DataInput in) throws IOException {

		synchronized (this.confData) {

			final int numberOfProperties = in.readInt();

			for (int i = 0; i < numberOfProperties; i++) {
				final String key = StringRecord.readString(in);
				final String value = StringRecord.readString(in);
				this.confData.put(key, value);
			}
		}
	}
1049852
@Benchmark
	@BenchmarkMode(Mode.AverageTime)
	public void byteBufferRandomAccessFile(final Configuration configuration) throws IOException {
		ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY);

		try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) {
			for (long i = 0; i < LINES; ++i) {
				if (buffer.remaining() < DATA.length) {
					file.write(buffer.array(), 0, buffer.position());
					buffer.rewind();
				}

				if (buffer.remaining() < DATA.length) {
					file.write(DATA);
				} else {
					buffer.put(DATA);
				}
			}

			if (buffer.position() > 0) {
				file.write(buffer.array(), 0, buffer.position());
			}
		}
	}
405202
public void add(String key, Collection<String> cves)
            throws VictimsException {
        key = hash(key);

        if (exists(key)) {
            delete(key);
        }

        String result = "";
        if (cves != null) {
            result = StringUtils.join(cves, ",");
        }

        try {
            FileOutputStream fos = new FileOutputStream(FileUtils.getFile(
                    location, key));
            try {
                fos.write(result.getBytes());
            } finally {
                fos.close();
            }
        } catch (IOException e) {
            throw new VictimsException(String.format(
                    "Could not add disk entry for key: %s", key), e);
        }

    }
597481
public static void addThreadMetaData(String tabName, String key, Object value) {
        THREAD_METADATA.get().addToTab(tabName, key, value);
    }
263641
public static void main(String[] args) throws IOException, InterruptedException {

        if (args.length < 4 || args.length > 5) {
            System.out.println(
                    "USAGE: HelloWorldServerTls host port certChainFilePath privateKeyFilePath " +
                    "[trustCertCollectionFilePath]\n  Note: You only need to supply trustCertCollectionFilePath if you want " +
                    "to enable Mutual TLS.");
            System.exit(0);
        }

        final HelloWorldServerTls server = new HelloWorldServerTls(args[0],
                Integer.parseInt(args[1]),
                args[2],
                args[3],
                args.length == 5 ? args[4] : null);
        server.start();
        server.blockUntilShutdown();
    }
704147
public void sshKey_POST(String key, String keyName) throws IOException {
		String qPath = "/me/sshKey";
		StringBuilder sb = path(qPath);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "key", key);
		addBody(o, "keyName", keyName);
		exec(qPath, "POST", sb.toString(), o);
	}
433408
@Override
    public void write(Object key, List<ByteBuffer> values) throws IOException
    {
        prepareWriter();
        try
        {
            ((CQLSSTableWriter) writer).rawAddRow(values);
            
            if (null != progress)
                progress.progress();
            if (null != context)
                HadoopCompat.progress(context);
        } 
        catch (InvalidRequestException e)
        {
            throw new IOException("Error adding row with key: " + key, e);
        }
    }
750892
public synchronized void updateMasterConf(PropertyKey key, @Nullable String value) {
    mMasters.forEach(master -> master.updateConf(key, value));
  }