       (copy (bytebuffer->inputstream bb) baos)
       (.toByteArray baos))))
 
-
-(defprotocol Encode
-  (encode [value]
-    "Encodes a Clojure value to a ByteBuffer."))
-
-(extend-protocol Encode
-  (Class/forName "[B")
-  (encode [value]
-    (ByteBuffer/wrap value))
-
-  String
-  (encode [value]
-    (let [encoder (.newEncoder (Charset/forName "UTF-8"))]
-      (.encode encoder (CharBuffer/wrap ^String value))))
-
-  Long
-  (encode [value]
-    (.putLong (ByteBuffer/allocate 8) value))
-
-  ByteBuffer
-  (encode [value]
-    value))
 
 
 ;;; Helper functions.

                       ^String name (.. meta name toString)]]
             [name (.compose type column)])
           (into {})))))


;;; Cassandra protocol implementation.

;;--- TODO: Test decoded types.
(defn- decode-resultset
  [^ResultSet resultset]
  (let [^List metas (.. resultset metadata names)]
    (for [^List row (.rows resultset)]
      (->> (for [[^ColumnSpecification meta ^ByteBuffer column] (zipmap metas row)
