ReadShort, ReadLong, WriteShort, and WriteLong

There’s no documentation on ReadShort, ReadLong, WriteShort, and WriteLong.
There’s a hint of reference to it on http://documentation.xojo.com/index.php/BinaryStream but there’s no entry that defines what exactly they do, and how long or short they read. Does anybody have some insight? I’m just trying to figure out the best way to store an image exactly as it is inside a database (I know, I know, it’s a bad idea.)

A Short is a 16 bit integer - read short reads one, write writes one
A Long is a 32 bit integer - read reads one, write writes one

Personally I’d stick to ReadInt32, WriteInt32 etc as they tell you exactly what size you’re reading & writing

Why wouldn’t you just be using Read?

I was just reading the docs and found this undocumented function and was curious to what it does. I try to read everything before I start coding. I had no idea they related to integers because nothing said it was :slight_smile:

BinaryStream.ReadShort (ReadLong, ReadByte) and the equivalent Write methods were actually all deprecated in 2006r1 in favor of the Int16/Int32 methods. They probably should be removed from Xojo at this point, rather than documented.

<https://xojo.com/issue/29166>

If you are seeing them referenced in any docs, please let me know so I can get that changed.

Paul,
There’s some example code in the LR that uses writeshort. If you just search WriteShort you’ll find it.

Thanks, I’ve updated it.

And it looks like it is truly deprecated and removed as of Xojo 2015 R2 (worked in Xojo 2015 R1).

Yep. I just opened up a project that in 2015 R2 that uses Thomas Templeman’s Zip classes and readlong and readshort throws an error. Glad I found this thread. The fix should be easy.

Has anyone told @Thomas Tempelmann about this?
Edit: it looks like the forum auto complete for users doesn’t play friendly with iOS…

I’m going to have to send Thomas a message because one of the changes needs to be made in one of his encrypted classes. I’m searching old emails with him to see if he gave me the key when I made a license donation but I may have to resort to waiting until he can fix it.
------- Edit
Ahh… before composing an email I downloaded the latest classes and it seems to be fixed.