HaxeFoundation/haxe

Lack of implementations in Bytes, BytesInput, BytesOutput

Open

#9,855 opened on Aug 20, 2020

 (0 comments) (7 reactions) (0 assignees)Haxe (704 forks)auto 404
help wanted

Repository metrics

Stars
 (6,901 stars)
PR merge metrics
 (PR metrics pending)

Description

Hi! Looks like a Bytes, BytesInput, and BytesOutput classes are missing some important implementations.

For example, Bytes class has:

read write
get (same as uint8) set (same as uint8)
getUInt16 setUInt16
getInt32 setInt32
getInt64 setInt64
getFloat setFloat
getDouble setDouble

Missing: getInt16, setInt16, getInt8, setInt8 Also, would be nice to have separate methods for getUInt8 and setUInt8, instead of using get/set. No way to change bytes order (probably it is by design, but...)

Also:

BytesInput BytesOutput
read (same as uint8) write (same as uint8)
readInt8 writeInt8
readInt16 writeInt16
readInt24 writeInt24
readInt32 writeInt32
readUInt16 writeUInt16
readUInt24 writeUInt24

Missing: read/write UInt32, read/write Int64, read/write UInt64, read/write Float, read/write Double.

So, there is no consistency and cross-platform way to work with all kinds of binary data from out of the box right now. Would be nice to have something like what JavaScript (and other languages) have, for example js.DateView class:

read write
getUint8 setUint8
getUint16 setUint16
getUint32 setUint32
getInt8 setInt8
getInt16 setInt16
getInt32 setInt32
getFloat32 setFloat32
getFloat64 setFloat64

Contributor guide