Why does LoaderInfo.bytes.bytesAvailable differ from bytesTotal ?

Before I give a code snippet, let me explain what I'm trying to do.
I'm trying to load an image from an arbitrary URL (user given), that can be any of jpeg, gif, png.
What I want is the compressed version of the image, not the bitmap. My goal is transmit it to my database in compressed form.
So with that in mind:
1. I first tried to use URLLoader
  => It returns the correct byteArray of the image but not the contentType (e.g. image/jpeg etc...)
2. Then I tried to use Loader
=> This returns both the contentType and the byteArray of the data, however the byteArray is not the same size as the image, there are some extra bytes. That's where loaderInfo.bytes.bytesAvailable differs from lodareInfo.bytesTotal.
Code snippet:
        private function onWebloadURL(url:String):void {
            var imageUrl:URLRequest = new URLRequest(url);
            var imageLoad:Loader = new Loader();
            imageLoad.contentLoaderInfo.addEventListener(Event.COMPLETE,OnWebloadURLLoaded);
            imageLoad.load(imageUrl);           
        private function OnWebloadURLLoaded(event:Event):void {
            // Here event.currentTarget.bytes contains some extra data
            // and currentTarget.bytes.bytesAvailable differs from currentTarget.bytesTotal
            // Note that currentTarget.bytesTotal contains the exact size of the file
How to get the raw data without the extra bits/encoding. Does it have to do with serialization ? I've been trying to figure it out but so far without success. So basically what I want is the byteArray returned from URLLoader and the contentType returned by Loader.
Note: I'm not interested in recompressing the image from a bitmap, since this would either degrade its quality or result in an overly big image which would consume too much bandwidth.

Loader will try to parse the image data.  I would think URLLoader is the
answer, but I'm not sure how to control contentType.

Similar Messages

  • Why does icloud account name differ from Apple ID?

    Hi all. My first Apple product was an iPad (original). At the time I had to set up an account. I used an email address that is no longer active. I've got a new Apple ID - which references my current active email address.
    I also have an iPhone. The Apple ID is current, and I'm able to use it to purchase APPS, and login to view my profile, etc.
    But, in Settings on the iPhone, when I click on iCloud, and the Account, it lists the original account name (which is the no-long active email address) and a blocked-out password which I don't remember. I'm unable to view Payment Information because it requires a password. I can no longer get wireless  on my iPad because the Payment Information credit card has expired.
    So - in sum - my ICloud info is wrong and inaccessible, but my Apple ID is accessible. What should I do????

    Hello Alligusto,
    After reviewing your post, I have located an article that can help with iCloud accounts. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
    iCloud: Account troubleshooting - Apple Support
    If you're unable to resolve an account issue, contact iCloud Support.
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • Why does my iPad continuously closes from where I'm working and takes me to home screen?

    Why does my iPad continuously close from where I'm working and takes me to home screen?

    It might be out of memory. Close all apps you're not using using the toolbar that comes up when you double click on the home button. Press and hold any icon and then tap on the red minus (-) symbol of the apps you're not using.

  • Why does my computer keep disconnecting from my wifi?

    Why does my computer keep disconnecting from my wifi?

    Some users with various Wi-Fi problems have reported that they were given the following instructions by Apple Support, sometimes with success. After completing the procedure, you'll have to recreate all your settings in the Networkpreference pane. Make sure you know how to do that before you begin. Taking screenshots of the preference pane may be helpful.
    Step 1
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    /Library/Preferences/SystemConfiguration
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A folder should open with an item named "SystemConfiguration" selected. Move the selected item to the Trash. You may be prompted for your administrator password. Reboot and recreate the network settings.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combinationcommand-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
    Step 2
    Reset the System Management Controller.
    Step 3
    Reset the PRAM.

  • Why does my mouse pointer change from a hand to a downward facing arrow sometimes?

    why does my mouse pointer change from a hand to a downward facing arrow sometimes?

    the-edmeister, you are a genious. I went to "view" then "toolbars" and de-selected "yahoo toolbar" and then moved the curser over my firefox page and it now works completely including the problem area (the top 3 cm of each screen). Thank you, thank you, thank you, thank you, thank you, thank you. You have no idea how good I feel know on this otherwise cold, windy and rainy day.

  • How does the content repository differ from the ECM plugin capability

    How does the content repository differ from the ECM plugin capability suh as Documentum. What are the different use cases. Which is the best to use for managing document uploads by user for association with user's personal products/services ?

    Content Repository is a standards-based, fully featured repository, included in all the editions of the Adobe Digital Enterprise Platform and Solutions. You can use it to store and access content, execute rich set of content services like search, authorization, etc. As such, it's ideally suited for all the content/document/asset-related needs of your applications. It offers the JCR API, plus access through RESTful interface and WebDAV network drive (among others). Additionally, managing content in the Content Repository makes it immediately availble for all the solutions that run of the platform.
    In essence, Content Repository is your go-to place to store and manage content in the Digital Enterprise Platform/Solutions. It is well suited to cater to your use case.
    The ECM Plugins (Connectors) are used if you have existing LiveCycle document services, and you have one of the ECM systems in your infrastructure used as archive. It allows you then to connect to such a 3rd-party system, and retrieve document for processing, as well as store them back for archiving.

  • Why does Firefox 'remember' a login from my last session when, on both occasions, I was using "Private Browsing"?

    Why does Firefox 'remember' a login from my last session when, on both occasions, I was using "Private Browsing"? How do I stop this (without clearing other data)?

    Try disabling hardware acceleration. Many visual bugs can be attributed to issues with graphics drivers.
    (Firefox -> Options -> Advanced -> General -> [ ] Use hardware acceleration when available)

  • How does the a1 serises differ from the a2107-7

    How does the a1 serises differ from the a2107-7
    Moderator Note; subject edited to reflect content

    Hi
    Welcome To Lenovo Community
    The IdeaTab A1 was one of the first Android tablets from Lenovo designed for budget-conscious users and was subsequently much cheaper than most of the competition at the time of launch
    The new IdeaTab A2 series targets the same budget to midrange audience, but now with two separate models (A2107 and A2109) differentiated mainly by their screen sizes.
    Please refer below link for more details
    http://www.notebookcheck.net/Review-Lenovo-IdeaTab-A2109A-Tablet.82834.0.html
    http://www.notebookcheck.net/Review-Lenovo-Ideapad-A1-Tablet.68869.0.html
    http://www.notebookcheck.net/Lenovo-announces-new-IdeaTab-S2110-A2107-and-A2109.81259.0.html
    Hope This Helps
    Cheers!!!
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    How to send a private message? --> Check out this article.
                            English Community   Deutsche Community   Comunidad en Español

  • Why does the color red change from working with images in develop to library?  The color gets lighter and nothing shows a change on histogram but visually you can see it.

    Why does the color red change from working with images in develop to library?  The color gets lighter and nothing shows a change on histogram but visually you can see it.

    That's probably a broken display profile. The conversion from Library's Adobe RGB is different than the conversion from Develop's linear ProPhoto, so if there's a problem with the display profile it can show up this way.
    Recalibrate, or if you don't have a calibrator use sRGB. If your monitor is a wide gamut model use Adobe RGB.
    Assuming Windows, change it in Control Panel > Color Management > Devices, and relaunch Lightroom so that it can pick up the new profile at startup:

  • When headset is inserted, why does sound continue to come from the speaker?

    When headset is inserted, why does sound continue to come from the speaker?

    Sure your inserting the headset into the Headphone Out port and not the In port..?
    Also what headset....?
    Most PC based headset with built in mic's will not work without using a device like the Griffin iMic.

  • Why does my Apple TV disconnect from the internet while Im watching Netflix? If I reboot my Apple TV, it seems to stay connected longer, but it still disconnnects me from my Wifi every 10 mins or so. I am not connected thru the eathernet cable.

    Why does my Apple TV disconnect from the internet while Im watching Netflix? If I reboot my Apple TV, it seems to stay connected longer, but it still disconnnects me from my Wifi every 10 mins or so. I am not connected thru the eathernet cable.

    If you try by Ethernet you can verify if the issue is with your WiFi network or if your appletv is defect as most users do not suffer as you do

  • Why does Adobe invoice charging VAT from Ireland to Spain?

    Why does Adobe invoice charging VAT from Ireland to Spain?

    Please refer to:
    1.VAT - Adobe Ireland?
    2.I have an email receipt.  Did you charge sales tax for the downloads?
    3.Billing: German VAT 23% ???
    4.Why is Adobe's UK website charging 23% VAT on Photoshop Elements 12 ?
    5.Adobe Store | Online order and payment FAQ
    n most parts of the world, Adobe is legally required to charge sales tax according to the calculations you see when you purchase online. If Adobe doesn't charge taxes, you are sometimes still liable to pay the taxes yourself.
    Adobe is registered in many different countries for which it is responsible for charging and collecting VAT/GST. For most sales, the rate charged depends on the country from which the goods or services are delivered. In Adobe European stores, you are charged the relevant VAT rate for hard goods and services.
    Regards
    Rajshree

  • Why does my external drive disappear from my desktop?

    I am switching from PC to Mac. I have 2 externaldrives. Both have been formatted in FAT 32 by the MAC. When I plug them in the desktop and finder see them, then with both of them they have disappeared from the desktop and from finder. Still can be seen in disk utility and system profiler. How can I find them and why does this happen?

    If you daisy chained then try without. May not be enough power to handle both at sme time. Other than that read some info:
    1. Shut-down your Mac, and unplug the power cord
    2. Turn the power off on your external FireWire devices
    3. Unplug the FireWire devices from the Mac
    4. Wait for 5 min.
    5. Plug the power cord to your Mac only
    6. For PPC Macs: Restart the Mac while holding the Option-Apple-O-F, and keep holding until you get the ">" prompt, then release the keys
    7. At the ">" prompt type:
          reset-nvram and hit the Return key
          set-defaults and hit the Return key
          reset-all and hit the Return key
    the last command will restart your mac
    8. Shut down your Mac
    9. Connect all your FireWire devices to the Mac and turn them on
    10. Restart your Mac.
    All your FireWire devices should reapear, if not repeat the procedure
    How to avoid the issue :
    The only really proven way to avoid burning up a FireWire port is to connect all devices and to turn them on PRIOR turning on the Mac. Likely, one must unplug them and turn them off AFTER the Mac has been turned off. If you need to connect another device, then you're on for a shutdown of your machine... 
It's a tad annoying but it guarantees that the FW ports won't be damaged. 
Be careful when using self powered devices such as webcams, iPods, hard drives or hubs, as they can destroy the port pretty easily. Another thing is to avoid daisy-chaining hard drives.
    When the FW port doesn't respond anymore :
    In this case, peripherals won't be mounted upon plugging, and won't be displayed in Apple's System Profiler. The self powered devices will still be fed by the port, but won't respond either. 
It happens that the PHY just hangs after a surge or a random problem. Once hung, the port will not respond any longer, it is possible to reset the component by going through the following steps :
    1° boot the PPC mac in Open Firmware by holding [ Apple key - Option - O - F ] after the startup chime. 
2° you'll get to a command prompt. the keyboard mapping will be QWERTY, so pay attention when you type the following : 
RESET-NVRAM (enter) 
RESET-ALL (enter) 
3° Now the mac should restart itself and the port should function properly again. 
If it still doesn't work, then it means that the PHY is damaged.
    http://www.hardmac.com/articles/16/
    From Kappy post:
    922 is only used in dual drive cases to provide a "build-in firmware RAID support"
    912 or 912+ is FW800, the "+" means USB2
    911 is FW400
    924 adds eSATA support along with FW400/800
    MacSales, OWC Tech Support library is where I would go first, as they do tend to have or links to, firmware updates for Oxford.
    From Wiebetech:
    I just upgraded my Mac OS, and now I'm having trouble with my FireWire device. What can I do?
    A: With nearly every OS update Apple releases, some external drives are not recognized after the update. The typical symptom is that the device will not mount but the volume is visible and grayed out in Disk Utility. This means that the device is working properly, but the OS does not recognize the volume as mountable. Sometimes the drive does not show up at all.
    The first thing to do is to see if repairing Permissions with Apple's Disk Utility First Aid feature solves the problem. If not, try repairing the disk with First Aid. Another possible solution is to zap the PRAM. This is done with a keyboard command while rebooting. Restart your computer and hold down the Command, Option, P and R keys. Consult the Apple web site for details.
    If this does not work, then try pushing the PMMU reset button on the logic board. Consult the Apple web site for locations of the button for your Mac. If the drive still does not show up, shut down, disconnect all peripheral devices, and boot from the Mac OS Installation CD. The later the OS version, the better. Do not reinstall the OS, but when the Installer is loaded up and ready to begin, go to the File menu and use the Disk Utility program. Connect the drive that is having problems, then start the Disk Utility application. If you see the external drive and it is not grayed out, you know the drive is okay. Run Disk First Aid on it anyway. Then run it on your internal boot drive while you are at it. When done, unmount the external drive and UNPLUG it! Then restart the Mac.
    When the Mac has restarted and is running on the internal boot drive, reconnect the external drive.

  • Why does Chrome open Flash Player from grave into Android?

    Hello Adobe Developer,
    I'm totally surprised because Google Chrome gets enabled Flash Player 11.7 / 11.8 on Android.
    I have tested with Youtube.com than i use Google Chrome under Android 4.1.2  ( Samsung Galaxy Note 10.1 )
    Is it fake or arvariable?
    I knew since August 2012 and Adobe Flash Player was died for Android. But why does it happen with Flash Player to surivived mode.
    I am using UC-Browser with Adobe Flash Player 11.1 =) It works fine.
    Now Google CHrome 27.x Version has updated with correct Flash Player 11.7 / 11.8. I am mad and surprised.
    Thanks-.....

    1. Try clearing your browser cache.
    2. Try updating your netwrok Adapter drivers.
    If all else fails, download the zip file here: https://workspaces.acrobat.com/app.html#d=LW2uMC-muU*eva7lwEmoww
    Unzip it, and double click the deepclean_set file.
    Your Disk Cleanup will open, but not like it usually does.
    Check EVERY box in the list and click OK.
    Next, double click the deepclean_run file and let the disk cleanup run to clear your temp files and other unnecessary clutter from your hard drive.

  • Why does Firefox remove the URL from the query string?

    Hello there,
    I've writing a servlet to read data from a file stored on a server. I'm using an HTTP <INPUT TYPE=file > element to locate the file to be read. When I run the servlet using IE as the browser it works fine. When I try running it using Firefox, the path to the file is not included in the query string. The full URL to the file shows up in the file input text field but then mysteriously disappears from the query string. Without the path, the servlet can't locate the file and the servlet fails. How do I get Firefox to include the path in the query string or is there some other workaround for this problem. I want my servlet to work on all types of browsers.
    thanks,
    grant

    Well you may also ask it the other way. Why does Microsoft send the full path file with the input type="file" component?
    The purpose of this control is to upload a file from the client to the server. That file is sent with the request.
    It does not allow you to browse server files at all. Most probably you are working on your developer machine where the client IS the server, so it works right now.
    It won't once they're seperate.
    <input type="file"> is the wrong tool to use to browser the server. You need to write your own html pages to do that.
    Cheers,
    evnafets

Maybe you are looking for