Wish ByteConverter <whatever>fromBytes would take a buffer length

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I am trying to reuse the same buffer over and over in reading from SD card

ByteConverter allows:
dim Temp() as ULong = BC.ULongsFromBytes(mBuffer)

The length that Temp has it the complete length of buffer. Would be nice if Byteconverter allowed a length when specifying the buffer

B4X:
            mSD.Position = xPosition
            mBufferInUse = mSD.Stream.ReadBytes(mBuffer, 0, xLength)

            Log("Read:", mBufferInUse)
            
            Dim Temp()         As ULong

            Temp = mByteConverter.ULongsFromBytes(mBuffer)  '  If byte converter allowed a length here it would return the right amount of ULongs instead of having to calc them

            Dim RealLongs    As Int        = mBufferInUse / 4     '  Length of a ULong is 4            
[/code

I've worked around it.  But would be nice
 
Top