[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-26 Thread Joao Coelho
--- In flexcoders@yahoogroups.com, Peter Farland <[EMAIL PROTECTED]> wrote:
>
> Just curious, where'd folks see the decoder docs talk about a
toString()? Base64Decoder's primary use is to decode to a ByteArray so
it has a toByteArray() method. If you wanted to construct a String
from this ByteArray you'd need to know the charset encoding used in
the bytes.
> 
> Pete
> 

My point was, in the docs there is a reference to a toString() method
as being inherited from Object.
Even if it is not reasonable to use toString(), it is in the docs as
being available.
Either it should be removed or an example of how to use the class
should be provided.

Joao



[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread John Luke Mills
I found this lying around.  It might work


package com.one2one.cliex.util{
import mx.utils.Base64Encoder;
import mx.utils.Base64Decoder;
import flash.utils.ByteArray;
public class B64String {
public static function
encodeString(plainString:String):String{
var b64encoder:Base64Encoder = new Base64Encoder();
var bArray:ByteArray = new ByteArray;
bArray.writeUTFBytes(plainString);

b64encoder.encodeBytes(bArray);
return(b64encoder.flush());
}//encodeString
public static function decodeString(eString : String):
String{
var b64decoder:Base64Decoder = new Base64Decoder();
var bArray:ByteArray;
b64decoder.decode(eString);
bArray = b64decoder.drain();

var temp : String = bArray.toString();
return(temp);
}//decodeString
}//class
}//package


Regards,  John Luke Mills



[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread jim.abbott45
Has ANYONE got a code sample (of the Decoder, especially) they'd like
to share? 

I'm using the Decoder right now and can't get it to work. Of course I
don't know yet if its in my AS3 code; the server guy's Base-64 code
(in Java); or--dare I say it--in the Flex library.




[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread johnlukemills
I found this lying around.  It might work.


package com.one2one.cliex.util{
import mx.utils.Base64Encoder;
import mx.utils.Base64Decoder;
import flash.utils.ByteArray;
public class B64String {
public static function encodeString(plainString:String):String{
var b64encoder:Base64Encoder = new Base64Encoder();
var bArray:ByteArray = new ByteArray;
bArray.writeUTFBytes(plainString);

b64encoder.encodeBytes(bArray);
return(b64encoder.flush());
}//encodeString
public static function decodeString(eString : String): String{
var b64decoder:Base64Decoder = new Base64Decoder();
var bArray:ByteArray;
b64decoder.decode(eString);
bArray = b64decoder.drain();

var temp : String = bArray.toString();
return(temp);
}//decodeString
}//class
}//package


Regards,  John Luke Mills




RE: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Peter Farland
No problem at all, they're confusingly close APIs and I totally agree they need 
more docs to explain how to use them. We _could_ create some form of 
toString()-like method though that could handle UTF-8 bytes (but ByteArray 
should give you that too with readUTF... I think we'd just need to know whether 
it was modified or unmodified UTF-8 as per the length header that can prefix 
the code points).

Pete


Re: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Doug McCune
Woops, my bad again. I gotta stop responding to threads without really
understanding what I'm talking about. I think I just noticed that both
have flush() methods and I assumed that was to a String (which is
wrong in the case of the decoder). I'll stop talking now.

On Thu, Sep 25, 2008 at 10:42 AM, Peter Farland <[EMAIL PROTECTED]> wrote:
> Just curious, where'd folks see the decoder docs talk about a toString()?
> Base64Decoder's primary use is to decode to a ByteArray so it has a
> toByteArray() method. If you wanted to construct a String from this
> ByteArray you'd need to know the charset encoding used in the bytes.
>
> Pete
>
>> -Original Message-
>> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
>> Behalf Of Doug McCune
>> Sent: Thursday, September 25, 2008 1:29 PM
>> To: flexcoders@yahoogroups.com
>> Subject: Re: [flexcoders] Re: Base64Encoder / Base64Decoder
>>
>> I assume the bug here is that the toString() method was supposed to be
>> implemented the same way in Base64Decoder as it is in Base64Encoder,
>> which would then make the docs at least make sense. But it looks like
>> that method simply got left out of the decoder class. Add it in just
>> like in the encoder and things aren't as confusing (although I'd argue
>> that using the toString() method to retrieve the result is an
>> inherently confusing way to use the classes).
>>
>> Doug
>>
>
> 


RE: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Peter Farland
Just curious, where'd folks see the decoder docs talk about a toString()? 
Base64Decoder's primary use is to decode to a ByteArray so it has a 
toByteArray() method. If you wanted to construct a String from this ByteArray 
you'd need to know the charset encoding used in the bytes.

Pete

> -Original Message-
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Doug McCune
> Sent: Thursday, September 25, 2008 1:29 PM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Re: Base64Encoder / Base64Decoder
>
> I assume the bug here is that the toString() method was supposed to be
> implemented the same way in Base64Decoder as it is in Base64Encoder,
> which would then make the docs at least make sense. But it looks like
> that method simply got left out of the decoder class. Add it in just
> like in the encoder and things aren't as confusing (although I'd argue
> that using the toString() method to retrieve the result is an
> inherently confusing way to use the classes).
>
> Doug
>



Re: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Doug McCune
I assume the bug here is that the toString() method was supposed to be
implemented the same way in Base64Decoder as it is in Base64Encoder,
which would then make the docs at least make sense. But it looks like
that method simply got left out of the decoder class. Add it in just
like in the encoder and things aren't as confusing (although I'd argue
that using the toString() method to retrieve the result is an
inherently confusing way to use the classes).

Doug

On Thu, Sep 25, 2008 at 10:26 AM, Doug McCune <[EMAIL PROTECTED]> wrote:
> woops, that was in Base64Encoder, not Decoder. My mistake.
>
> On Thu, Sep 25, 2008 at 10:25 AM, Doug McCune <[EMAIL PROTECTED]> wrote:
>> In my version of the SDK source the toString method is defined and
>> looks like this:
>>
>> public function toString():String
>>{
>>return flush();
>>}
>>
>> On Thu, Sep 25, 2008 at 10:15 AM, Joao Coelho <[EMAIL PROTECTED]> wrote:
>>> --- In flexcoders@yahoogroups.com, Peter Farland <[EMAIL PROTECTED]> wrote:

 What do you want to do with Base64? I might be able to point you at
>>> an example. I've also logged a bug for documentation to ask them to
>>> provide examples in these classes (note this, and commenting on the
>>> live docs, is a better way to get the doc team's attention).
>>> https://bugs.adobe.com/jira/browse/FLEXDOCS-509

>>>
>>> The problem was with the toString() method in Base64Decoder(which does
>>> not exist), according to the docs "Returns the string representation
>>> of the specified object.".
>>> The application threw a compile time error because the method did not
>>> exist.
>>> I ended up using the flush() method, after checking source code for
>>> the class, hence my comment on the previous post about the source.
>>> But thanks anyway.
>>>
>>> 
>>
>


Re: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Doug McCune
woops, that was in Base64Encoder, not Decoder. My mistake.

On Thu, Sep 25, 2008 at 10:25 AM, Doug McCune <[EMAIL PROTECTED]> wrote:
> In my version of the SDK source the toString method is defined and
> looks like this:
>
> public function toString():String
>{
>return flush();
>}
>
> On Thu, Sep 25, 2008 at 10:15 AM, Joao Coelho <[EMAIL PROTECTED]> wrote:
>> --- In flexcoders@yahoogroups.com, Peter Farland <[EMAIL PROTECTED]> wrote:
>>>
>>> What do you want to do with Base64? I might be able to point you at
>> an example. I've also logged a bug for documentation to ask them to
>> provide examples in these classes (note this, and commenting on the
>> live docs, is a better way to get the doc team's attention).
>> https://bugs.adobe.com/jira/browse/FLEXDOCS-509
>>>
>>
>> The problem was with the toString() method in Base64Decoder(which does
>> not exist), according to the docs "Returns the string representation
>> of the specified object.".
>> The application threw a compile time error because the method did not
>> exist.
>> I ended up using the flush() method, after checking source code for
>> the class, hence my comment on the previous post about the source.
>> But thanks anyway.
>>
>> 
>


Re: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Doug McCune
In my version of the SDK source the toString method is defined and
looks like this:

public function toString():String
{
return flush();
}

On Thu, Sep 25, 2008 at 10:15 AM, Joao Coelho <[EMAIL PROTECTED]> wrote:
> --- In flexcoders@yahoogroups.com, Peter Farland <[EMAIL PROTECTED]> wrote:
>>
>> What do you want to do with Base64? I might be able to point you at
> an example. I've also logged a bug for documentation to ask them to
> provide examples in these classes (note this, and commenting on the
> live docs, is a better way to get the doc team's attention).
> https://bugs.adobe.com/jira/browse/FLEXDOCS-509
>>
>
> The problem was with the toString() method in Base64Decoder(which does
> not exist), according to the docs "Returns the string representation
> of the specified object.".
> The application threw a compile time error because the method did not
> exist.
> I ended up using the flush() method, after checking source code for
> the class, hence my comment on the previous post about the source.
> But thanks anyway.
>
> 


[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Joao Coelho
--- In flexcoders@yahoogroups.com, Peter Farland <[EMAIL PROTECTED]> wrote:
>
> What do you want to do with Base64? I might be able to point you at
an example. I've also logged a bug for documentation to ask them to
provide examples in these classes (note this, and commenting on the
live docs, is a better way to get the doc team's attention).
https://bugs.adobe.com/jira/browse/FLEXDOCS-509
>

The problem was with the toString() method in Base64Decoder(which does
not exist), according to the docs "Returns the string representation
of the specified object.".
The application threw a compile time error because the method did not
exist.
I ended up using the flush() method, after checking source code for
the class, hence my comment on the previous post about the source.
But thanks anyway.



RE: [flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Peter Farland
What do you want to do with Base64? I might be able to point you at an example. 
I've also logged a bug for documentation to ask them to provide examples in 
these classes (note this, and commenting on the live docs, is a better way to 
get the doc team's attention). https://bugs.adobe.com/jira/browse/FLEXDOCS-509


[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Joao Coelho
--- In flexcoders@yahoogroups.com, "nathanpdaniel" <[EMAIL PROTECTED]> wrote:
>
> I don't think it's ever been documented like everything else... I've 
> been searching for any type of documentation on it since... Flex 2 
> beta - STILL nothing.
> 
Pretty much what I figured...
At least there's source code to check, unlike in the flash.* package.
Oh well, one can only hope Adobe's Flex team is too busy fixing bugs
and developing usefull things instead of updating the docs.
;)



[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread nathanpdaniel
I don't think it's ever been documented like everything else... I've 
been searching for any type of documentation on it since... Flex 2 
beta - STILL nothing.

--- In flexcoders@yahoogroups.com, "Joao Coelho" <[EMAIL PROTECTED]> 
wrote:
>
> --- In flexcoders@yahoogroups.com, Samuel Colak  wrote:
> >
> > check adobes online version of the documents
> > 
> I did, it does not have the updated info...
>




[flexcoders] Re: Base64Encoder / Base64Decoder

2008-09-25 Thread Joao Coelho
--- In flexcoders@yahoogroups.com, Samuel Colak <[EMAIL PROTECTED]> wrote:
>
> check adobes online version of the documents
> 
I did, it does not have the updated info...