I want to download and image from the url and image is in byte format

hi
i want to download the image from the url:
http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
can any one help me to do this i need to finish this today plz help me.
first 5 character 09593 is the length of the image we need to substract image length from total length.
thanks in advance
M.Raj
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM

hi
thanks for the reply,
that works only if .png file is there in the path.
i worked it out, it is working fine now
try
               httpConn = (HttpConnection)Connector.open(url);
               is=httpConn.openInputStream();
               responseCode = httpConn.getResponseCode();
               if(httpConn.getResponseCode() == 200)
                         ByteArrayOutputStream bStrm = null;
                         byte[] data = new byte[512];
                         int contentLen = httpConn.getHeaderFieldInt("Content-Length", 0);
                         if(contentLen > 0)
                              response = new byte[contentLen];
                         else
                              bStrm = new ByteArrayOutputStream();
                         int count = 0, tmp =0;
                              while ((count = is.read(data)) >= 0)
                                   if( contentLen > 0 )
                                        for(int i=0;i<count && tmp+i < contentLen;i++)
                                             response[tmp+i] = data;
                                        tmp += count;
                                   else
                                        bStrm.write(data, 0, count);
//                                    if( aborted)
//                                         break;
                              data = null;
                              System.gc();
                              if( contentLen <= 0 )
                                   response = bStrm.toByteArray();
                                   bStrm.close();
                                   bStrm = null;
                                   System.gc();                                   
                    else
//                          main.showAlert("ERROR","Connection failed.Please access again later");
//                          main.changeToMain();
          catch(Exception e){
               response = null;
               responseCode = 0;
//                main.showAlert("ERROR","Connection failed.Please access again later");
//                main.changeToMain();
          catch(OutOfMemoryError e){
//                main.showAlert("ERROR","Not enough memory, please disable some apps or delete files and try again.");
//                main.changeToMain();
          finally
               System.out.println("Before Creation"+response.length);
               img = Image.createImage(response, 5, response.length-5);
               System.out.println("After Creation");
               CanvasImageFile canvas = new CanvasImageFile(this);
               midlet.display.setCurrent(canvas);
               try
                    if( is != null )
                         is.close();
                         is=null;
               catch(Exception ex){
//                     main.showAlert("ERROR","Connection failed.Please access again later");}
                         if( httpConn != null )
                         try {
                                   httpConn.close();
                              } catch (IOException e) {
                                   // TODO Auto-generated catch block
                                   e.printStackTrace();
                         httpConn=null;

Similar Messages

  • I wanted to download a book from the store and I kind of changed my store site from Ghana to U.S.please where do I go to change it to my country site to be able to download stuffs again

    I wanted to download a book from the store and I kind of changed my store from Ghana to United States. Can't download anything now.please I need help on how to switch my store back to ghana

    Change your country on iPhone, iPad, or iPod touch
    Tap iTunes Store, App Store, or iBooks Store.
    At the bottom of the Featured page, tap Sign In.
    If you're already signed in, skip to step 5.
    Tap Use Existing Apple ID.
    Enter your Apple ID and password and tap OK.
    Tap your Apple ID.
    Tap View Apple ID or View Account.
    Tap Country/Region.
    Tap Change Country or Region.
    Tap the Store menu and tap your country.
    Tap Next.
    Review the Terms and Conditions and Apple Privacy Policy.
    Tap Agree if you agree to the terms and conditions.
    In the prompt that appears, tap Agree.
    Select a payment method and enter your payment information.
    Enter your billing address and tap Next.

  • I want to download an image from the url and image is in byte format

    hi
    i want to download an image from the url
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    first 5 digits will be the length of the image,we need to download except first 5 digits and display an image file
    i need to finish this today
    pla reply if any body knows solution for this.
    thanks in advance
    Mraj

    You do not need to do anything - iPhoto always keeps the original and you can revert to it at any time
    If you want to be able to see the original and the cropped version in iPhoto at the same time duplicate the photo (this does not really duplicate but simply starts a new edit stream for the photo - command-d) and crop the duplicate
    LN

  • I need to download image from the url and the image is in byte format.

    hi
    i need to download image from the url
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    first 5 digits will be its length,we need to download except 5 digits.
    can any one know how to do that.
    thanks in advance
    Mraj

    hi
    i need to download image from the url
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    first 5 digits will be its length,we need to download except 5 digits.
    can any one know how to do that.
    thanks in advance
    Mraj

  • HT1386 I am re-building my iTunes library, but still have all the content on my iPod Classic.  I have just downloaded some songs from the store and want to add them to the iPod, BUT when i attempt this the message asks if I want to delete all content on t

    I am rebuilding my iTunes library, but still have all the old content on my iPod Classic.  I have just download some songs from the iStore and want to add them to the iPod, BUT when I try to sync it asks if I want to delete all content from the iPod and add only the material that I have just downloaded from the Store.  I do not want to lose my old content, because it is very extensive.

    You are trying to sync to other than the one iTunes library you can sync to. You can copy music from multiple library/computer if you use the manual method of syncing. That method is described here
    iTunes: Syncing media content to iOS devices and iPod
    If you want to make this computer/iTunes library your syncing computer/library you have to restore the iPod on this computer/library. Restoring erases the iPod.
    You can redownload most iTunes purchases by:
    iTunes: Syncing media content to iOS devices and iPod
    To copy other music to the computer see:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities
    BTW this is the iPod touch forum

  • TS1702 can not download any program from the App and I can not update any program downloaded in advance .. Seems to me just to wait and remain so throughout the day .. I want a solution to this problem

    can not download any program from the App and I can not update any programdownloaded in advance .. Seems to me just to wait and remain so throughout the day .. I want a solution to this problem 

    Any solution!!!!!!!

  • Download files from the URL and store them in the table

    Hello,
    I want to download files from the URL and want to store them in the table.
    Can I do it using sql/pl-sql.
    Please help me on this.
    Thanks,
    Rajendra Yadav

    Never tried it before...
    Is this what you are talking about?
    http://www.oracle-base.com/articles/10g/file-upload-download-procedures-10g.php
    Cheers,
    Manik.

  • How do you copy images from the internet and paste them on Microsoft Word

    I'm trying to copy images from the internet and trying to paste them on to Microsoft Word and Powerpoint for an assignment but it's not working. I tried to use copy and paste and then paste special but nothing is working. Saving the image onto documents and trying to open them on Microsoft Word still doesn't work.
    PLEASE HELP!!!
    Thank you

    Hi Lily, and welcome to Apple Discussions.
    A screenshot can capture almost anything you're viewing. Hold the command and shift keys down, then press the 4 key and release all keys. Hold down the mouse button and drag the cursor to the size/area of the image you want to capture. Release the mouse button and you've captured the image. Remember that it is the individual's responsibility to respect copyright laws.

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • My iTunes says I owe $5.25 for songs that I have already paid for and am not going to pay for again but I want to get some apps from the store and now there's a hold on my account. Who do I talk to get the hold taken off

    I explained it most in my question but I am getting charged double for songs that I have already paid for and am not going to pay for twice because that is messed up. But I want to get some apps from the store and it wont let me because of $5.25. Who can I talk to about resolving this issue?

    You're right, it would have been covered under warranty. But because of the user damage, chances are there's a 200-something dollar fee . If you explain to them that it had a defect previously, they might replace it for you at no charge. **MIGHT**. But they would have to believe that it had a defect previously.

  • I download an app. But doesn't show up on my homepage. I go to download it again from the cloud and all I get is a message saying "you already download this application so you will be able to redownload the app free of charge" I press ok.Still don't have

    I download an app. But doesn't show up on my homepage. I go to download it again from the cloud and all I get is a message saying "you already download this application so you will be able to redownload the app free of charge" I press ok. Still don't have it

    What is the app? What "homepage" do you mean?

  • I want to send a response from the servlet and then call another servlet.

    Hi,
    I want to send a response from the servlet and then call another servlet. can this happen. Here is my scenario.
    1. Capture all the information from a form including an Email address and submit it to a servlet.
    2. Now send a message to the browser that the request will be processed and mailed.
    3. Now execute the request and give a mail to the mentioned Email.
    Can this be done in any way even by calling another servlet from within a servlet or any other way.
    Can any one Please help me out.
    Thanks,
    Ramesh

    Maybe that will help you (This is registration sample):
    1.You have Registration.html;
    2.You have Registration servlet;
    3.You have CheckUser servlet;
    4.And last you have Dispatcher between all.
    See the code:
    Registration.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
      <HEAD>
        <TITLE>Hello registration</TITLE>
      </HEAD>
      <BODY>
      <H1>Entry</H1>
    <FORM ACTION="helloservlet" METHOD="POST">
    <LEFT>
    User: <INPUT TYPE="TEXT" NAME="login" SIZE=10><BR>
    Password: <INPUT TYPE="PASSWORD" NAME="password" SIZE=10><BR>
    <P>
    <TABLE CELLSPACING=1>
    <TR>
    <TH><SMALL>
    <INPUT TYPE="SUBMIT" NAME="logon" VALUE="Entry">
    </SMALL>
    <TH><SMALL>
    <INPUT TYPE="SUBMIT" NAME="registration" VALUE="Registration">
    </SMALL>
    </TABLE>
    </LEFT>
    </FORM>
    <BR>
      </BODY>
    </HTML>
    Dispatcher.java
    package mybeans;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Dispatcher extends HttpServlet {
        protected void forward(String address, HttpServletRequest request,
                               HttpServletResponse response)
                               throws ServletException, IOException {
                                   RequestDispatcher dispatcher = getServletContext().
                                   getRequestDispatcher(address);
                                   dispatcher.forward(request, response);
    Registration.java
    package mybeans;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Registration extends Dispatcher {
        public String getServletInfo() {
            return "Registration servlet";
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            ServletContext ctx = getServletContext();
            if(request.getParameter("logon") != null) {          
                this.forward("/CheckUser", request, response);
            else if (request.getParameter("registration") != null)  {         
                this.forward("/registration.html", request, response);
    CheckUser.java
    package mybeans;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class CheckUser extends Dispatcher {
        Connection conn;
        Statement stat;
        ResultSet rs;
          String cur_UserName;
        public static String cur_UserSurname;;
        String cur_UserOtchestvo;
        public String getServletInfo() {
            return "Registration servlet";
        public void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try{
                ServletContext ctx = getServletContext();
                Class.forName("oracle.jdbc.driver.OracleDriver");
                conn = DriverManager.getConnection("jdbc:oracle:oci:@eugenz","SYSTEM", "manager");
                stat = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
               String queryDB = "SELECT ID, Login, Password FROM TLogon WHERE Login = ? AND Password = ?";
                PreparedStatement ps = conn.prepareStatement(queryDB); 
               User user = new User();
            user.setLogin(request.getParameter("login"));
            String cur_Login = user.getLogin();
            ps.setString(1, cur_Login);
            user.setPassword(request.getParameter("password"));
            String cur_Password = user.getPassword();
            ps.setString(2, cur_Password);
         Password = admin");
            rs = ps.executeQuery();
                 String sn = "Zatoka";
            String n = "Eugen";
            String queryPeople = "SELECT ID, Surname FROM People WHERE ID = ?";
           PreparedStatement psPeople = conn.prepareStatement(queryPeople);
                      if(rs.next()) {
                int logonID = rs.getInt("ID");
                psPeople.setInt(1, logonID);
                rs = psPeople.executeQuery();
                rs.next();
                       user.setSurname(rs.getString("Surname"));
              FROM TLogon, People WHERE TLogon.ID = People.ID";
                       ctx.setAttribute("user", user);
                this.forward("/successLogin.jsp", request, response);
            this.forward("/registration.html", request, response);
            catch(Exception exception) {
    }CheckUser.java maybe incorrect, but it's not serious, because see the principe (conception).
    Main is Dispatcher.java. This class is dispatcher between all servlets.

  • TS3106 I just downloaded this app from the store, and it WILL NOT OPEN.

    I just downloaded this app from the store, and it WILL NOT OPEN. I've deleted it and reinstalled it and it still crashes whilst loading everything. I'd really like to use this software....please help.......

    Make sure you have the latest version of iTunes, which is available here -> http://www.apple.com/itunes/download/
    Then try following the steps in this Apple article to create an account without a credit card -> Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • I want to cancel my account from the iTunes and all my bank information

    i want to cancel my account from the itunes and all my bank information

    Contact Apple customer service by sending an email through the Contact Us link at the bottom of the Apple.com iTunes support page. Let them know you want to cancel an iTunes account and they'll contact you for further information. However, note that if you choose this option, it may also hinder your ability to access the purchases you've previously made, particularly on computers that weren't authorized before you cancelled the account.

  • HT1473 i have downloaded some songs from the internet and saved it on my desktop. how do i transfer those songs to itunes?

    i have downloaded some songs from the internet and saved it on my desktop. but i do not know how to import the songs from that folder to itunes.

    Just drag the song(s) to iTunes, if they are one of these formats (wav, m4a, mp3, mp4, wma etc) and they will appear under Music library.
    If you have lots of music files, put them in a folder and go iTunes menu FILE, Add folder to library..... to add this folder at one go.

Maybe you are looking for

  • While video taping, the camera says videoing stopped automatically.

    I purchased my canon rebel t2i at Staples, along with a 16GB card with a 10 in the top rt corner.  When recording with my camera, it will often say videoing has stopped automatically. I also cleared everything off the card .  I had it checked today b

  • Interactive Buttons in PDF not working when in iPhone

    Hello! I used CS3 to turn an InDesign document into an interactive PDF with buttons. It works just fine in a computer, but when I tried to view it in an iPhone, all interactive buttons are gone. Does anyone know why? Thanks! Here's the link for the P

  • Number of Vendor in the given date range

    Hi All, I have a requirement like I need to calculate Total Number of Vendors in a given Date in Report Level. Could anyone please let me know how to do this? Thanks in advance. with Regards, Mahi.S

  • 3.1.3 Third party apps issue

    I recently upgraded to 3.1.3 on my iphone from my macbook pro. Once everything was loaded up and synced, my third party apps will no longer start. Has anyone that is experiencing this same issue from the update have a solution to fix this?

  • EJBs inside clusters ?

    Hi, does anybody have any experience on starting some kind of OC4J servers cluster? Is it easy to have then common JNDI namespace (when one EJB deployed on one calls another EJB deployed on another node without any trouble)? Is it possible at all? Th