blob: 6838f8623f2105912e76e914ab7ebc1cb18663fe [file] [log] [blame]
Austin Schuh272c6132020-11-14 16:37:52 -08001import Foundation
2
3public final class FlatBuffersUtils {
4
5 /// Gets the size of the prefix
6 /// - Parameter bb: Flatbuffer object
7 public static func getSizePrefix(bb: ByteBuffer) -> Int32 {
8 return bb.read(def: Int32.self, position: bb.reader)
9 }
10
11 /// Removes the prefix by duplicating the Flatbuffer
12 /// - Parameter bb: Flatbuffer object
13 public static func removeSizePrefix(bb: ByteBuffer) -> ByteBuffer {
14 return bb.duplicate(removing: MemoryLayout<Int32>.size)
15 }
16}