Convert file into byteArray

Hi, I have a file named programa.class and I would like to copy its byte content into a byte array, so I can send it later through the COM1 port. Can someone give me an example of how can this be done? Thanks in advance.

for your enjoyment ...
  try {
  String inpName = "dime.zip";
  File inpFile = new File(inpName);
  long lcount = inpFile.length();
  int icount = (int) lcount;
  InputStream inp = new FileInputStream(inpFile);
  int acount = inp.available();
  if (icount != acount) {
    System.out.println("all bytes not available");
    return;
  byte[] iobytes = new byte[acount];
  int ic = 0;
  while (ic < acount) {
    ic += inp.read(iobytes, ic, acount - ic);
  inp.close();
  } catch (IOException ioe) {System.out.println(ioe);}

Similar Messages

  • Can i see an sample of a converted file into an excel format

    can i see an sample of a converted file into an excel format

    Preview can destroy a PDF file without even trying.
    See -> http://khkonsulting.com/2013/06/preview-app-killer-of-pdf-files/.
    Just don't use Preview to view or attempt to interact with PDF files.
    Clinton

  • How to convert files into DAT?

    Does anyone know how to convert files into DAT? Not The other way around please.

    This might do it:
    http://www.videoconverterformac.com/dat-converter-for-mac.html
    but can't imagine why you would want to!

  • Does anyone know how to convert file into a .png?

    Does anyone know how to convert file into a .png?
    Thanks

    I tried to give an answer with less steps. I know it's a Pages file & all you have to do is select & copy the content in your Pages file & then open Preview.app. Next time I'll include the exporting to PDF & opening that in Preview.app or in Pages go to File > Print > click on the PDF button in the lower left of the print window & choose Open in Preview.

  • Converting files into pdf format in java

    Hi all,
    How can we convert a file into PDF format in java?My application does the
    file upload, and I need the files to be converted into PDF format.
    The uploaded file can be of any type. How can I do this?
    Please give me some help.
    Thanks and regards,
    Sandeep.

    >
    How can we convert a file into PDF format in java?My application does the
    file upload, and I need the files to be converted into PDF format.
    The uploaded file can be of any type. ...>1) Write a class that will intelligently render a file of any type..
    2) ... (well, do '1' first, then after getting your Nobel prize for AI, come back and we'll talk)
    >
    Please give me some help.>Please review your requirement.
    BTW
    - PDF sucks. It is designed for printing, and I (for one) don't want to kill more trees, and have no printer.
    - This subject (convert file to PDF) has been discussed on the forums a bazillion times. Did you search the forums before asking your two (very closely related) questions?

  • Convert file into XSTRING

    Hi expert,
    I want test some Function Module, and for do this i need to convert a generic file (pdf doc txt) into XSTRING... And after convert XSTRING into file, with use mimetype to read this...
    I search into FM, and in SDN but i don't find anything, can someone help me to do this??
    Thank you all...

    Hi,
    Check if FM SCMS_FTEXT_TO_XSTRING can be of help.
    Regards, Bert

  • Convert file into Base64

    Hi all,
    I'm trying to convert a file into Base64 code and I'm not getting the result I expected. The file is attached to a Purchase Requisition and the process needs to run in background - this means I can't use FM's like GUI_UPLOAD to help me complete this task. Here is a portion of the code I'm using:
      Get object information
    CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
      folder_id = folder_id
      object_id = object_id
    TABLES
      objcont   = objcont.
    READ TABLE objcont.
    i_valor = objcont-line.
    SEARCH i_valor FOR '='.
    IF sy-fdpos <> 0.
    i_valor = i_valor+sy-fdpos.
    i_valor = i_valor+1.
    SEARCH i_valor FOR space.
    i_class = i_valor(10).
    i_objid = i_valor+10.
    ENDIF.
      Get file phisical ID
    CLEAR: log, phi.
    log-class = i_class.
    log-objid = i_objid.
    CALL FUNCTION 'SO_LOIO_PHIO_GET'
    EXPORTING
       loio_object        = log
    IMPORTING
       phio_object        = phi
    EXCEPTIONS
       kpro_inconsistency = 1
       x_error            = 2
    OTHERS             = 3.
      Get file content in binary
    CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
      EXPORTING
         object_id           = phi
         raw_mode            = 'X'
      TABLES
        file_access_info    = access_info
        file_content_ascii  = cont_ascii
        file_content_binary = cont_binary
    EXCEPTIONS
        not_existing        = 1
        not_authorized      = 2
        no_content          = 3
        bad_storage_type    = 4
    OTHERS              = 5.
    Retrieve base64 and invoke Webservice for upload
        CLEAR: line2, first_time, last_block.
        LOOP AT cont_binary.
          DESCRIBE TABLE cont_binary LINES len_cont_binary.
          MOVE cont_binary-line TO line_aux.
    Check if it is last block
          IF sy-tabix EQ len_cont_binary.
            last_block = 'true'.
          ELSE.
            last_block = 'false'.
          ENDIF.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text   = line_aux
      IMPORTING
        buffer = input_str.
    CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
       EXPORTING
         input  = input_str
      IMPORTING
         output = output_str.
    If I compare my result in "output_str" I see it is different than when I use a software to retrieve the Base64, and when I try to open the file it is corrupted.
    Can you help me?
    Thanks in advance.
    Kind regards,
    Ricardo

    HI Hyma,
    As Stefan specifyed already as per my knowledge we dont have any standard procedure for all the requirements you specified.....we need to go for module in the adapter.
    Cheers!!!
    Naveen.

  • Converting Files into iTunes

    I recently installed iTunes and the program transfered over my music from My music folder into iTunes it also started converting file types over. I had to stop the process of converting the file types and iTunes didn't completely convert all my files. How do I tell it to finish?
    Thanks
    Alexis

    Just read other articles re: livewire or what eveer it is. I went to add/remove programs and immediately got rid of it. I'm not sure how it got there and have talked to other users of my computer aboutit.
    Was able to copy some of my songs (some of my own compositons from midi device even) but after update ipod, couldn't transfer more songs next time I tried.

  • Converting files into PDF/A format

    Hello,
    My main questions are:
    1) How can I convert a normal document (say, word document) into PDF/A format using Adobe Acrobat 8.0 standard (that's what we use in the office)?
    2) When we convert a file into PDF using Adobe Acrobat, does it save the file automatically in PDF/A format or is it normal PDF?
    3) How can I tell if a file is in PDF/A format?  Will it have a different extension than PDF?
    4) What disadvantages are there related to PDF/A format (if any)?

    Thanks pogopossum,
    I'm using now Goodreader. This has also the advantage of a good interlinking to other available documents.
    This is also not functioning with ibooks. Goodreader has some drawbacks compared to ibooks.
    You cannot recognize the books easily since no frontpages are present and you need to scroll more to find the correct document. A annoying thing is that once you enlarge the index and jump to a linked page that page will show up in the enlarged fashion. So you always need to resize the new page. This problem is not present in ibooks. An enormous good feature of Goodreader is the easy and many ways to import files.

  • How to convert files into pdf forms? (claiming winning forms)?

    How to convert into forms into pdf files?

    Please refer : http://www.adobe.com/content/dam/Adobe/en/products/acrobat/pdfs/adobe-acrobat-xi-convert-f orms-into-fillable-pdf-tutorial_ue.pdf

  • Is my code right about convert file into input stream?

    InputStream is = new FileInputStream(file);
    Parser ps = new Parser(file);
    //create xml document
    TXDocument doc = ps.readStream(is);
    I am using j2sdk1.4 and IBM XML for java Parser v2.0
    Thanks a lot
    D

    1 - JDBC is the wrong way to extract this data. It's like "What's the fastest way
    to copy the Oxford English Dictionary using tweets?" I would research the
    DBMS's bulk extract functionality.
    2 - Are you dead-set absolutely sure you need to do this at all? What can you
    do with the data all in one flat file that you cannot do with SQL access to the
    data?
    3 - If you want to convert all the columns into one (not that it's a huge
    win or anything), you can use the DBMS's conversion and concatenation
    functionality in your SQL. So instead of
    "select col1, col2, col3, .... from MyBigTable"
    do (change this to whatever conversion function syntax and concat syntax your DBMS needs)
    "select convert(col1, varchar) concat ' ' concat convert(col2, varchar) concat ' ' concat convert(col3, varchar) ... from MyBigTable"
    so the result set you get is a single column.
    Joe

  • Converting files into Word

    Can you please tell me what version of Word PDF converts into Word?

    Hi,
    ExportPDF would convert the PDF to the document compatible with MS Word version 2003 and 2007 onwards.
    You just need to choose the your option from the dropdown, if you are using MS Word 2003 then you need to choose .doc while conversion and if you are on higher version then MS Word 2003 then you need to choose .docx from the dropdown
    ~Pranav

  • How do i add videos to iphone?? i have tried all the convertors but still its not happening!! ..i cannot add or drag the converted file into itunes?? can someone please help me soon and suggest me some good video convertors for adding videos to my phone??

    someone lease help me with this. for the past two days i have been hitting my head for this !!

    Glad they finally added a "Home Videos" tag, but wish that it was a compeltely separate category like Music, Movies, TV Shows. Still have all my home videos tagged as a "TV Show" with track numbers to keep them in order, disc number x of 12 to indicate the month, and season used to indicate the year. Has worked nicely for years but every new version of iTunes I hope (and have suggested) that they will separate this out.
    A real way to maintain home movie metadata and organization would be much appreciated. Giving Home Videos as a tab within Movies is a start, but doesn't recognize the fact that these kinds of videos are completely different from "Movies." People scroll through or look for movies by name, home videos by date or event (more like iPhoto organizes things). Nobody wants to hunt for baby's first steps in a big alphabetical list somewhere between "The Avengers" and "Willy Wonka."

  • Problem download document into Micro Word format after clicking a converting file

    Dear friends,
    Pls help as i am not able open document from microword . It happened after i click converting file into ???something that i forget. The document that open is in not complete sentence and mix with symbols .
    I cant download my lecture note anymore .
    Pls help me how to convert back to my previous function pls.
    Many thks
    Tess

    Hi Tess Tay,
    If you are not able to open any word document then please contact Microsoft Support.

  • System shutting down when converting files

    Downloaded 7.5.0.20 and when I try to convert files into Ipod format from existing WMA my PC goes into uncommanded reboot. Not linked to any other applications that I can see and happens too frequently to be anything else. (Running latest AVG antivirus V7.5.516
    Have NEVER had this problem before, and have 23Gb of files in Windows Media Player.
    Anyone have any thoughts on what might be conflicting or causing the issue?

    Found the problem lay with hardware not software - actually overheating the PC as the chip heatsink was clogged with dust. Strange that nothing else had caused reboot but then again life can be strange.....

Maybe you are looking for

  • Treeview, keep focus on clicked node ?

    First post here, hope I am in the right location. I am using Visual Studio Express 2103 for web. On my asp page I have a Treeview with 4 Levels. From sql server I load the hierarchy as TopLevel-->                   Product-->                         

  • Increase Messaging

    I am currently on the Nation Talk FS 700 plan for $60/month plus 3 extra lines @ $9.99/ each.  It appears that this plan has been discontinued and is now replaced by a slightly different plan name with 700 anytime minutes for $89.99 month.  I'd like

  • Ideal Premiere Pro export settings BEFORE compressor

    I'm editing with Premiere Pro these days... I've currently been exporting 1080p h.264 mov files in order to put them into compressor ad have compressor do it's thing to make them internet ready. Is there an "ideal" setting that I should be using BEFO

  • Oracle DB on Redhat 5 connectivity with MS sql Server

    Dear All, Env. Oracle EBS R12 – DB 10gR2 with RAC on Redhat linux 5 We want to connect OracleDB10gR2 to MS sql Server 2000/2005 on Windows 2003. What is the way or which utility(ODBC) can be used to do this, anybody help us with detail?? Regards

  • Change server time in Standby Database or primary database in Dataguard

    Hi all, I configuration dataguard for 2 site. But after finishing, I saw the time not synchronize. I want to change time setting in standby server but I don't sure Dataguard configuration will still running normally. Please explain for me about synch