Board index » delphi » uneven size in encode.

uneven size in encode.

Hi,

  Im using TidEncdoerMime to encode a stream to Base64. But sometimes it
throws up 'uneven size in encode' - looked through google and the web and
came up with nothing.

Im calling the function like this

filestream := Tfilestream.Create(OpenDialog1.FileName, fmOpenRead);
myval := encoder.Encode(filestream, filestream.Size);

I cant see what im missing.

TIA

D

 

Re:uneven size in encode.


Quote
"dvorak" <dvora...@ifrance.com> wrote in message

news:3e6afde1@newsgroups.borland.com...

Quote
>   Im using TidEncdoerMime to encode a stream to Base64. But sometimes it
> throws up 'uneven size in encode' - looked through google and the web and
> came up with nothing.

> Im calling the function like this

> filestream := Tfilestream.Create(OpenDialog1.FileName, fmOpenRead);
> myval := encoder.Encode(filestream, filestream.Size);

> I cant see what im missing.

Check the help file:

function Encode(ASrcStream: TStream; const ABytes: Integer = MaxInt):
string; override;

Parameters

ASrcStream: TStream
  Stream containing the values to be encoded.

const ABytes: Integer = MaxInt
  Number of bytes in ASrcStream to be encoded. Default value is MaxInt.

...

ABytes is an Integer that represents the number of bytes in ASrcStream to be
encoded. The default value for ABytes is MaxInt. If a value other than
MaxInt is specified, ABytes must be a multiple of 3 or an EIdException will
be raised with the RSUnevenSizeInEncodeStream message. When ABytes contains
the value MaxInt, the user-defined FillChar will be appended to the input
stream until the length is the required 3 bytes.

hth...

--
Don

Join the Indy Docs project! (http://www.indyproject.org/teams/docs)

ELKNews - Get your free copy at http://www.atozedsoftware.com

Re:uneven size in encode.


Hi Don,

Quote
> Check the help file:

> function Encode(ASrcStream: TStream; const ABytes: Integer = MaxInt):
> string; override;

> Parameters

> ASrcStream: TStream
>   Stream containing the values to be encoded.

> const ABytes: Integer = MaxInt
>   Number of bytes in ASrcStream to be encoded. Default value is MaxInt.

> ...

> ABytes is an Integer that represents the number of bytes in ASrcStream to
be
> encoded. The default value for ABytes is MaxInt. If a value other than
> MaxInt is specified, ABytes must be a multiple of 3 or an EIdException
will
> be raised with the RSUnevenSizeInEncodeStream message. When ABytes
contains
> the value MaxInt, the user-defined FillChar will be appended to the input
> stream until the length is the required 3 bytes.

> hth...

Yes, it helps alot. I could not find the help files. Will downlaod them
asap. Thank you

D

Other Threads