https://github.com/krzyzanowskim/rawdata
Swift RawData CollectionType
https://github.com/krzyzanowskim/rawdata
Last synced: 2 months ago
JSON representation
Swift RawData CollectionType
- Host: GitHub
- URL: https://github.com/krzyzanowskim/rawdata
- Owner: krzyzanowskim
- Created: 2015-08-29T07:02:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-29T07:45:08.000Z (about 10 years ago)
- Last Synced: 2025-07-30T07:42:34.343Z (2 months ago)
- Language: Swift
- Size: 160 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
RawData
=======....is the Swift class to deal with collection of bytes. Attempt to build CollectionType type that works with collection of bytes. It is more or less `Array`
```swift
let raw = RawData([1,2,3,4,5,6]) // initialized with array of bytes
let byte = raw[0] // first byte
print(raw.description) // "<01020304 0506>"raw.replaceRange(0...3, with: [10,9,8] // replace data
let shifted = raw << 3 // shift bytes left [4,5,6,0,0,0]
let or = shifted | [0,0,0,7,8,9] // [4,5,6,7,8,9]raw.append(10) // [4,5,6,7,8,9,10]
```
License: MIT, Author: [Marcin Krzyżanowski](http://twitter.com/krzyzanowskim)