Esempio n. 1
0
  private InputStream getInputStream(String resPath, Result r) throws IOException {
    if (r == null) {
      return null;
    }
    byte[] value = r.getValue(B_FAMILY, B_COLUMN);
    if (value.length == 0) {
      Path redirectPath = bigCellHDFSPath(resPath);
      Configuration hconf = HadoopUtil.getCurrentHBaseConfiguration();
      FileSystem fileSystem = FileSystem.get(hconf);

      return fileSystem.open(redirectPath);
    } else {
      return new ByteArrayInputStream(value);
    }
  }
Esempio n. 2
0
  private Path writeLargeCellToHdfs(String resPath, byte[] largeColumn, HTableInterface table)
      throws IOException {
    Path redirectPath = bigCellHDFSPath(resPath);
    Configuration hconf = HadoopUtil.getCurrentHBaseConfiguration();
    FileSystem fileSystem = FileSystem.get(hconf);

    if (fileSystem.exists(redirectPath)) {
      fileSystem.delete(redirectPath, true);
    }

    FSDataOutputStream out = fileSystem.create(redirectPath);

    try {
      out.write(largeColumn);
    } finally {
      IOUtils.closeQuietly(out);
    }

    return redirectPath;
  }