private static byte[] loadFromHadoopFs(final Configuration conf, final String s,
    final int maxSize) throws IOException {
    final Path path = new Path(s);
    final FileSystem fs = FileSystem.get(path.toUri(), conf);
    LOG.info("Loading file {}", path);
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final FSDataInputStream in = fs.open(path);
    try {
      final byte[] buffer = new byte[8192];
      int n, len = 0;
      do {
        n = in.read(buffer);
        if (n > 0) {
          len += n;
          if (len > maxSize) {
            throw new IOException("Dictionary " + s + " is too large, limit=" + maxSize);
          }
          baos.write(buffer, 0, n);
        }
      } while (n > 0);
    } finally {
      in.close();
    }
    return baos.toByteArray();
  }
Load a dictionary or return a previously cached load.
@param conf configuration
@param path the hadoop Path where the dictionary is located, as a String
@return the dictionary bytes if successful, null otherwise
hbase-common/src/main/java/org/apache/hadoop/hbase/io/compress/DictionaryCache.java