class AtomKeyValueParser {

    public static AtomKeyValueParser parse(Key key, Value value) throws IOException {
        AtomKeyValueParser atom = new AtomKeyValueParser();
        
        String row = key.getRow().toString();
        int splitPoint = row.indexOf(DELIMITER);
        if (splitPoint != -1) {
            atom.setCollectionName(row.substring(0, splitPoint));
            int delim = key.getRow().find(DELIMITER);
            byte[] b = key.getRow().getBytes();
            long diff = LongCombiner.FIXED_LEN_ENCODER.decode(Arrays.copyOfRange(b, delim + 1, key.getRow().getLength()));
            long time = (Long.MAX_VALUE - diff);
            atom.setUpdated(new Date(time));
        } else {
            throw new IllegalArgumentException("Atom entry is missing row parts: " + key);
        }
        atom.setId(AtomKeyValueParser.encodeId(key.getColumnFamily().toString()));
        String colf = key.getColumnFamily().toString();
        splitPoint = colf.indexOf(DELIMITER);
        if (splitPoint != -1 && splitPoint + 1 != colf.length()) {
            atom.setValue(colf.substring(0, splitPoint));
            atom.setUuid(colf.substring(splitPoint + 1));
        } else {
            throw new IllegalArgumentException("Atom entry is missing column qualifier parts: " + key);
        }
        atom.setColumnVisibility(key.getColumnQualifier().toString());
        
        return atom;
    }

}