code: public static void export(Descriptor desc, PrintStream outs, Collection<String> toExport, String[] excludes, CFMetaData metadata) throws IOException
      {
          SSTableReader sstable = SSTableReader.open(desc);
          RandomAccessReader dfile = sstable.openDataReader();
          try
          {
              IPartitioner partitioner = sstable.partitioner;
  
              if (excludes != null)
                  toExport.removeAll(Arrays.asList(excludes));
  
              outs.println("[");
  
              int i = 0;
  
              // last key to compare order
              DecoratedKey lastKey = null;
  
              for (String key : toExport)
              {
                  DecoratedKey decoratedKey = partitioner.decorateKey(metadata.getKeyValidator().fromString(key));
  
                  if (lastKey != null && lastKey.compareTo(decoratedKey) > 0)
                      throw new IOException("Key out of order! " + lastKey + " > " + decoratedKey);
  
                  lastKey = decoratedKey;
  
                  RowIndexEntry entry = sstable.getPosition(decoratedKey, SSTableReader.Operator.EQ);
                  if (entry == null)
                      continue;
  
                  dfile.seek(entry.position);
                  ByteBufferUtil.readWithShortLength(dfile); // row key
                  DeletionInfo deletionInfo = new DeletionInfo(DeletionTime.serializer.deserialize(dfile));
  
                  Iterator<OnDiskAtom> atomIterator = sstable.metadata.getOnDiskIterator(dfile, sstable.descriptor.version);
                  checkStream(outs);
  
                  if (i != 0)
                      outs.println(",");
                  i++;
                  serializeRow(deletionInfo, atomIterator, sstable.metadata, decoratedKey, outs);
              }
  
              outs.println("\n]");
              outs.flush();
          }
          finally
          {
              dfile.close();
          }
      }
docs: Export specific rows from an SSTable and write the resulting JSON to a PrintStream.
  
  @param desc     the descriptor of the sstable to read from
  @param outs     PrintStream to write the output to
  @param toExport the keys corresponding to the rows to export
  @param excludes keys to exclude from export
  @param metadata Metadata to print keys in a proper format
  @throws IOException on failure to read/write input/output