7 bit int encoding is a wellknown variable lengtrh encoding. You can find the definition of it in the Java class file format (and some other places ;-);-).
-- Henkk ----- Original Message ----- From: "Marsh, Drew" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 18, 2002 10:28 PM Subject: Re: [DOTNET] BinaryWriter.Write( string ) > John Lam [mailto:[EMAIL PROTECTED]] wrote: > > > With short strings, it does write out the length as a single > > byte. With longer strings, it does expand it to a word. Now, > > when reading this thing back in, how does one determine > > whether the length prefix is one or two bytes???? > > John, > > While I don't have time to totally dissect it right this second, I whipped > out ILDASM and looked at BinaryReader::GetString and it defers to a > protected method called BinaryReader::Read7BitEncodedInt which seems to use > BinaryReader::ReadInt in two different forms to figure out if it should read > it as a byte or a word. > > Like I said I don't have time to dissect the algorithm they use to know when > it's a word vs. a byte, but hopefully this will send you down the right > path. > > HTH, > Drew > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.