Beispiel #1
0
        /// <summary>
        /// Since the given buffer may not have an array, this will automatically perform necessary edits to get a <see cref="ushort"/> array (this uses ushort because of how java handles datatypes)
        /// </summary>
        /// <param name="buffer"></param>
        /// <returns></returns>
        private static ushort[] GetFromShortBuffer(ShortBuffer buffer)
        {
            List <ushort> data = new List <ushort>();

            while (buffer.hasRemaining())
            {
                short v = buffer.get();
                // This is kinda expensive ngl
                data.Add(BitConverter.ToUInt16(BitConverter.GetBytes(v), 0));
            }
            return(data.ToArray());
        }