Liking cljdoc? Tell your friends :D

hara.io.binary


bitseqclj

(bitseq obj)

converts to a bitseq binary representation

(binary/bitseq (byte-array [49])) => [1 0 0 0 1 1]

converts to a bitseq binary representation

(binary/bitseq (byte-array [49]))
=> [1 0 0 0 1 1]
raw docstring

bitsetclj

(bitset obj)

converts to a bitset binary representation

(-> (binary/bitset "100011") (bitset-to-bitseq)) => [1 0 0 0 1 1]

converts to a bitset binary representation

(-> (binary/bitset "100011")
    (bitset-to-bitseq))
=> [1 0 0 0 1 1]
raw docstring

bitstrclj

(bitstr obj)

converts to a bitstr binary representation

(binary/bitstr (byte-array [49])) => "100011"

converts to a bitstr binary representation

(binary/bitstr (byte-array [49]))
=> "100011"
raw docstring

bufferclj

(buffer len-or-elems)
(buffer
  len-or-elems
  {:keys [type direct endian convert wrap]
   :or
     {type :byte direct false endian +endian-native+ convert true wrap false}})

either creates or wraps a byte buffer of a given type

(buffer 10) => java.nio.ByteBuffer

(buffer 10 {:type :float :convert false}) => java.nio.ByteBuffer

(buffer 10 {:type :float :direct true}) => java.nio.FloatBuffer

either creates or wraps a byte buffer of a given type

(buffer 10)
=> java.nio.ByteBuffer

(buffer 10 {:type :float
            :convert false})
=> java.nio.ByteBuffer

(buffer 10 {:type :float
            :direct true})
=> java.nio.FloatBuffer
raw docstring

buffer-readclj

(buffer-read buff)
(buffer-read buff arr)

reads primitive array from buffer

(def -buf- (buffer 4)) (def -out- (int-array 1))

(do (.put -buf- 3 (byte 1)) (buffer-read -buf- -out-) (first -out-)) => 1

reads primitive array from buffer

(def -buf- (buffer 4))
(def -out- (int-array 1))

(do (.put -buf- 3 (byte 1))
    (buffer-read -buf- -out-)
    (first -out-))
=> 1
raw docstring

buffer-writeclj

(buffer-write buff arr)

writes primitive array to a buffer

(def -buf- (buffer 16)) (buffer-write -buf- (int-array [1 2 3 4]))

[(.get -buf- 3) (.get -buf- 7) (.get -buf- 11) (.get -buf- 15)] => [1 2 3 4]

writes primitive array to a buffer

(def -buf- (buffer 16))
(buffer-write -buf- (int-array [1 2 3 4]))

[(.get -buf- 3) (.get -buf- 7) (.get -buf- 11) (.get -buf- 15)]
=> [1 2 3 4]
raw docstring

byte-bufferclj

(byte-buffer len-or-elems)
(byte-buffer len-or-elems {:keys [type direct endian convert] :as opts})

bytesclj

(bytes obj)

converts to a byte array binary representation

(-> (binary/bytes "100011") (seq)) => [49]

converts to a byte array binary representation

(-> (binary/bytes "100011")
    (seq))
=> [49]
raw docstring

char-bufferclj

(char-buffer len-or-elems)
(char-buffer len-or-elems {:keys [type direct endian convert] :as opts})

double-bufferclj

(double-buffer len-or-elems)
(double-buffer len-or-elems {:keys [type direct endian convert] :as opts})

float-bufferclj

(float-buffer len-or-elems)
(float-buffer len-or-elems {:keys [type direct endian convert] :as opts})

input-streamclj

(input-stream obj)

creates an inputstream from various representations

(input-stream 9223372036854775808N) => java.io.ByteArrayInputStream

creates an inputstream from various representations

(input-stream 9223372036854775808N)
=> java.io.ByteArrayInputStream
raw docstring

int-bufferclj

(int-buffer len-or-elems)
(int-buffer len-or-elems {:keys [type direct endian convert] :as opts})

long-bufferclj

(long-buffer len-or-elems)
(long-buffer len-or-elems {:keys [type direct endian convert] :as opts})

numberclj

(number obj)

converts to a number binary representation

(binary/number "100011") => 49

converts to a number binary representation

(binary/number "100011")
=> 49
raw docstring

output-streamclj

(output-stream obj)

creates an inputstream from various representations

(output-stream (fs/file "project.clj")) => java.io.FileOutputStream

creates an inputstream from various representations

(output-stream (fs/file "project.clj"))
=> java.io.FileOutputStream
raw docstring

short-bufferclj

(short-buffer len-or-elems)
(short-buffer len-or-elems {:keys [type direct endian convert] :as opts})

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close