public void writeResultSetSlice(ResultSetSlice rss) throws IOException {
    if (trace == API_TRACE_DETAILED) {
      Log.current.println("writeResultSetSlice = " + rss);
    }

    ResultSet rs = rss.resultSet();
    
    int first = rss.first();
    int last = rss.last();
    int columnCount = rss.columnCount();
    
    write(CFASL_RESULT_SET_SLICE);
    writeInt(rss.rowCount());
    writeInt(rss.sliceRowCount());
    writeInt(columnCount);
    writeInt(first);
    
    try {
      rss.beforeFirst();
      for (int row = first; row <= last; row++) {
 	rs.next();
 	for (int column = 1; column <= columnCount; column++) {
 	  writeObject(rs.getObject(column));
 	}
      }
    }
    catch (SQLException e) {
      throw new RuntimeException(e.getMessage());
    }
  }