Problem working with binary file

Hi,
I have two seperate programs.
The first one:
*Reads a  PDF file from disk via InputStreamReader.read(char[])
*converts it to s String [String.valueOf(char[])]
connects to other program using Socket and writes the string's bytes to the OutputStream of the Socket (socket.getOutputStream().write(string.getBytes);)
Second one:
*Reads the file from socket via BufferedReader.read(char[])
*converts it to a string via String.valueOf()
*writes it to a file using FileOutputStream.write(content.getBytes())
The problem is:
If the secong program is running on Win2K,the PDF file is opened with no errors but the pages are all blank.But everything is OK if it is running on Unix(IBM AIX java ver 1.3.1)
First program is always on Win2K.
I compared the win2k and unix PDF files,some nonprintable chars are displayed as ? in the win2K one,
what can be the reason? why does the same problem not occur on Unix?
Some problems are mentioned on web/forums but these are related with browsers or servlets which I am not using in this case.
Thanks in advance,

PDF is a binary file.
You're doing 1 of 2 possible things wrong....
1) trying to read a binary file as a text file ( string )
You can't "just read" a binary file as a text file to extra the strings.
You need to get the binary format, and parse it's format properly to extract the
string data.
2) trying to send a binary file across a socket as a string
You need to read the PDF file as an array of bytes and send them across
the socket as such. Trying to convert binary data to characters / strings
is wrong. characters get converted to and from native encoding schemes to
unicode.... among other problems.
regards,
Owen

Similar Messages

  • Problems working with raw files

    just purchased elements 5 to work with raw files. have downloaded 4.2 and installed it into correct file and have moved existing raw 8 bit file to desktop. when i try to import raw files into elements it still wont let me. stating error or wrong file type or something. i am working with windows xp. and shooting with a nikon D80.

    [email protected] wrote in
    news:[email protected]:
    > Martin ... Not many Elements users here ... the Elements forum is
    > here:
    >
    >
    > That said ... check Elements' 'Help' menu for the ability to list the
    > verion of ACR installed, and any ability to "update" automatically.
    >
    > HTH :)
    >
    I don't think that ACR 4.2 will work with Elements 5.
    John Passaneau

  • Problems working with source files

    Just downloaded the new 1343 release. Really like the product. But ... working with source files in SQL Developer is my worst nightmare. When I open a source file either from SQL Worksheet or from File/Open menu my PC freezes for an extended period of time. CPU utilization shots up to 100% and stays this high until the tab is open. I am on Windows XPSP2. Help!!!.

    We have reproduced your issue. If I open a large plsql program from the main SQL developer window (File Open) option it opens in a second or less. If from within the SQL worksheet, i right click and do a file / open on a small file it open in a second or less. If I right click in the SQL worksheet and do a file/open of a larger plsql program it appears to hang SQL developer.
    We are looking into the issue.
    Thanks,
    Mike

  • Problems working with linked files in illustrator

    Hi everyone, i hope you can help me with this doubt that had given me problems since I started using illustrator. I'm using linked files in illustrator because i'm able to modify the files later, as I do in InDesign too, but in both cases I had have a lot of problems with the links, I don't know if i'm doing something bad, but this is what I do: I create a folder where I place my file (illustrator or InDesign) and the files that should be linked. Whit this i'm expecting of it to work like an html where the links works while they are in the folder, no matter if you move the folder, the links keeps working on the HTML.
    But I have noticed that it doesn't work in the same way, because, I had have cases when the links work perfectly, but then i format my computer (Mac) and after that, I open my files againg but the links don't work already. I have exactly the same problem with my coworker, because im trying to edit a file with linked files since the place where it is in the other computer, obviously it opens perfectly there, but in my computer it asked to repair the links, so I select to repair automatically but I ask me to does it manually... So this is getting me tired, because I must repair the links here in my computer to work on it, and when for it get finished, my coworker should repair the links again, and this is going to be always we share files or i format my computer. It is important to mention that my coworker and me use mac with leopard and the same version of adobe (CS4).
    So, as I said before, i dont knoe if my method is incorrect, should I do something different? any option to activate? or program that I should use? because I have herd a lot of Adobe Bridge, I don't know if this could have a option that could help me.
    I hope finally somebody can help me with this doubt, because im sure that I'm not the only one having thie problem.
    Thanks for your help

    Hi. I am also experiencing this very annoying problem. Currently using version CS2, but this problem dates back to version 9.  I check the box to link a tif file, not embed it, in Illustrator. All is well until I save and reopen the file. Suddenly the file is embedded. No other changes have been made to the folders or anything else. It just embeds itself and cannot be linked again.
    So far, I conclude that something in the file itself has corrupted, because it is not possible to place a new file and have it link correctly again. So if I anticipate more changes, I create a new file.
    Notice the upper left corner of the top toolbar. If you click on a file that has embedded itself, the file will be identified as "Group" instead of "linked file."
    I've tried all kinds of things, like trying to ungroup it, trying to release a clipping mask, and so forth, to see what went wrong. Have not figured it out.

  • Working with binary files

    I want to save in the MIME Repository an image, I already did it using this code:
    DATA: lr_mime_rep TYPE REF TO if_mr_api.
    DATA: lv_filename TYPE string.
    DATA: lv_path TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lv_content TYPE xstring.
    DATA: lv_length TYPE i.
    DATA: lv_rc TYPE sy-subrc.
    DATA: lt_file TYPE filetable.
    DATA: ls_file LIKE LINE OF lt_file.
    DATA: lt_data TYPE STANDARD TABLE OF x255.
    PARAMETERS: p_path TYPE string
    DEFAULT 'SAP/PUBLIC/Test.jpg'. "<<-- Mime path, save to path
    cl_gui_frontend_services=>file_open_dialog(
    CHANGING
    file_table = lt_file " Table Holding Selected Files
    rc = lv_rc ). " Return Code, Number of Files or -1 If Error Occurred
    READ TABLE lt_file INTO ls_file INDEX 1.
    IF sy-subrc = 0.
    lv_filename = ls_file-filename.
    ENDIF.
    cl_gui_frontend_services=>gui_upload(
    EXPORTING
    filename = lv_filename " Name of file
    filetype = 'BIN'
    IMPORTING
    filelength = lv_length " File length
    CHANGING
    data_tab = lt_data " Transfer table for file contents
    EXCEPTIONS
    OTHERS = 19 ).
    CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
    EXPORTING
    input_length = lv_length
    * first_line = 0
    * last_line = 0
    IMPORTING
    buffer = lv_content
    TABLES
    binary_tab = lt_data
    EXCEPTIONS
    failed = 1
    OTHERS = 2.
    lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
    lr_mime_rep->put(
    EXPORTING
    i_url = p_path
    i_content = lv_content
    EXCEPTIONS
    parameter_missing = 1
    error_occured = 2
    cancelled = 3
    permission_failure = 4
    data_inconsistency = 5
    new_loio_already_exists = 6
    is_folder = 7
    OTHERS = 8 ).
    But I want to directly fill the  lt_data with a string that holds the binary code of the image, I mean
    I don't have the image, only the binary code, I try to do it uploading the .bin file also in .txt format, and
    I don't get it :S ,   how can I achieve this?
    Thanks in advance!

    I´m not sure if Im understanding what you´re saying... If you dont describe the path, then the file will be created in the project folder, right?
    check this program out
    it doesnt specifies a path but if you try run it the file will be created in the project folder. ¨
    import java.io.*;
    import java.util.*;
    /**  Write a primitive type data array to a binary file.**/
    public class BinOutputFileApp
      public static void main (String arg[]) {
        Random ran = new Random ();
        // Create an integer array and a double array.
        int    [] i_data = new int[15];
        double [] d_data = new double[15];
        // and fill them
        for  (int i=0; i < i_data.length; i++) {
          i_data[i] = i;
          d_data[i] = ran.nextDouble () * 10.0;
        File file = null;
        // Get the output file name from the argument line.
        if (arg.length > 0) file = new File (arg[0]);
        // or use a default file name
        if (file == null) {
            System.out.println ("Default: numerical.dat");
            file = new File ("numerical.dat");
        // Now write the data array to the file.
        try {
          // Create an output stream to the file.
          FileOutputStream file_output = new FileOutputStream (file);
          // Wrap the FileOutputStream with a DataOutputStream
          DataOutputStream data_out = new DataOutputStream (file_output);
          // Write the data to the file in an integer/double pair
          for (int i=0; i < i_data.length; i++) {
              data_out.writeInt (i_data);
    data_out.writeDouble (d_data[i]);
    // Close file when finished with it..
    file_output.close ();
    catch (IOException e) {
    System.out.println ("IO exception = " + e );
    } // main
    } // class BinOutputFileApp

  • Has anyone not working with .dv files had synchronization problems?

    Has anyone not working with .dv files had sound synchronization problems? I'm not exactly sure what the alternatives to DV are, but I think one of them is HD.
    The reason for asking this question is to help isolate the nature and cause of a very serious flaw in iMovie '11. In the original release of iMovie '11 (version 9.0) there was a small--but serious--synchronization problem. In the 9.01 there is a large synchronization problem. We know of one person who has not experienced the problem, and he is not working with DV files (media). So we want to find out if anyone who is using something other than .dv files is experiencing a lack of synchronization between sound and picture. Knowing the answer to this will help with figuring out where the cause lies. For the initial iMovie '11 release (9.0), you probably would not notice a problem unless you had very long event-clips, e.g., two hours long. Events get this long if you are transferring from analog 8 mm tapes. Even then, it would have to be in scenes in which the connection between event and sound is obvious, e.g., close ups of people talking. It isn't until the 9.01 release that most people would notice anything. All we need to do is establish one case of a synchronization problem in which the person is using something other than DV.
    Message was edited by: Paul Bullen

    Hopefully, the 9.0.2 release will make my question moot. Zyfert must have posted the announcement of the release just as I was formulating my question. Still, if you have information on the subject, it would be interesting to hear.

  • Unexpected problem: uncaught exception when working with audio files in Soundtrack Pro

    Hey,
    Whenever I double click an audio file in the timeline to work on it, I end up getting the Error message: "Unexpected problem: uncaught exception" and Soundtrack Pro eventually crashes.  Also, this happens when I try to work with audio files in the file editor.  I have Leopard and am using Logic Studio 8.  Any insight would be much appreciated. Thanks
    Matt

    Didnt know how to remove the original clip from the STP arrange window - or whatever it's called in STPro.  So I could go no further in my perverse science experiment. 
    It also appeared that I could only import an aif but not a wav? 
    I gave up on STPro and did what I needed to do in Logic, which I use regularly.    
    Thank you for folowing up on this. 
    PS.  I used to use an old PowerPC version (1.0.3) of STPro and loved the way it visually showed the change in the waveform when you added each efffect.  It appears that the new version (3.0.1) does not allow you to do this anymore?  You can render or flatten the effects to see the final waveform, but then you are dead in the water and cant make changes?  
    Im such a newbie at STPro that I am probably not using it right? 

  • Problem when load more swf files work with xml files into my movie

    hi ;
    I have one flash file & more of swf files which work with xml files .
    when I load one swf file into my flash file  and remove it and load anther one on the same movieclip in my flash file it load the old swf file.
    when i load one on movieclip and remove it and load anther swf  on anther movieclip the file doesn`t work  and stoped.
    when test my flash file to load and remove swf files without xml file it work fine but when repleaced the swf files with other work with xml files the problem hapend.
    thanks;

    YOu should trace the names of the files that are being targeted for loading to see if they agree with what you expect.  If you want help with the coding you will need to show the code that is relevant to your problem (not all of it)

  • Very slow responce when working with Office file on DFS-Share

    Very slow responce when working with Office file on DFS-Share
    We have implemented the following configuration
    Domain level Windows 2000. Two member servers with Windows Server 2008 R2, sharing the same DFS namespace with, at the moment, one folder target called Home.
    Users complaining that the access to different MS Office files is very slow. Even creating a new MS Word document using right click context menu takes up to 4 minutes to open. Saving, for example, one singe Excel sheet takes also few minutes.
    Tested with both, MS Office 2007 and MS Office 2010. Makes no difference. When using Office 2010 you can see the message like contacting:
    \\DomainName\Root\Home\UserName. Other files like TXT, JPG or PDF are not affected.
     What makes the thing really weird is the fact, that the behavior described above can absolutely change after client machine being rebooted, suddenly everything becomes very fast and this condition can revert back again just after the next
    reboot.
    Considerations until now:
    1. This has nothing to do with the file size. Even tiny files are affected.
    2. AD Sites are configured correctly and the client workstations see themselves in the correct sites.
    3. This is not an Office issue. If I map my folder target not as DFS, but directly as shared network drive
    \\ServerName\Root\Home\UserName , everything functions as expected
    What makes me suspicious: when using f.e. TCPView to monitor connections, I can see, that each time I make any operation on an office file, there will be a connection established to one of the domain controllers, sometimes to remote ones,
    located in other countries. But on the other side, even if the connection is established to the nearest DC, operations are still very very slow!
    Just forget to say. All clients are Windows 7
    Thanks to all who respond.

    Dear all,
    sorry for the delayed reply. The problem has been solved now and since September 19<sup>th</sup>. everything is functioning as expected.
    What was done:
    Deleted replication targets excepting the initial ones
    Carefully recreated folder targets
    Deleted and recreated  replication groups
    Disabled SNP features on both namespace servers
    Created EnableTCPA registry entry
    Checked that the following Updates are installed
    http://support.microsoft.com/kb/2688074
    http://support.microsoft.com/kb/2647452
    Concering Office File validation KB2553065 - This Update was already declined on our WSUS server
    Kind Regards
    Eduard

  • Working with video files on compatible external drive with imovie09

    I have run out of room on my MacBook Pro hard drive, so I have moved all of my video files onto a compatible external hard drive. How do I work with these file in imovie09, do I need to import the files back onto the computer or can I work with them from the external hard drive, if so how. Also, is it possible to after completing editing to save just the project on the computer rather than the hard drive or will that cause a "source video" issue.
    Ultimately, I would like to have all of the source video saved on the external hard drive and the projects saved on the computer
    I had no problems working and saving the files when just using the computer, the external hard drive has complicated things for me. Thanks.

    John Pichola wrote:
    I have run out of room on my MacBook Pro hard drive, so I have moved all of my video files onto a compatible external hard drive. How do I work with these file in imovie09, do I need to import the files back onto the computer or can I work with them from the external hard drive, if so how. Also, is it possible to after completing editing to save just the project on the computer rather than the hard drive or will that cause a "source video" issue.
    How did you move all of your video files? The best way in iMovie '09 is to do it in the Event Library. Make sure you're viewing hard drives (click the disk icon at the upper-right corner of the list of events). Then drag the events you want from your internal hard disk to the external one. That way iMovie keeps track of where the source files are located.
    You can do the same with project files in the Project Library, too.
    If you've already moved the files in the Finder, to do it cleanly, I'd recommend moving them back to the iMovie Projects and iMovie Events folders in your Movies folder. Then launch iMovie and move them as explained above.
    Or, make sure the iMovie Projects and iMovie Events folders are at the top level of your external hard drive. When you launch iMovie, it looks in those places for footage and projects, and will make them available.

  • Photoshop CS6 keeps freezing when I work with large files

    I've had problems with Photoshop CS6 freezing on me and giving me RAM and Scratch Disk alerts/warnings ever since I upgraded to Windows 8.  This usually only happens when I work with large files, however once I work with a large file, I can't seem to work with any file at all that day.  Today however I have received my first error in which Photoshop says that it has stopped working.  I thought that if I post this event info about the error, it might be of some help to someone to try to help me.  The log info is as follows:
    General info
    Faulting application name: Photoshop.exe, version: 13.1.2.0, time stamp: 0x50e86403
    Faulting module name: KERNELBASE.dll, version: 6.2.9200.16451, time stamp: 0x50988950
    Exception code: 0xe06d7363
    Fault offset: 0x00014b32
    Faulting process id: 0x1834
    Faulting application start time: 0x01ce6664ee6acc59
    Faulting application path: C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Photoshop.exe
    Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll
    Report Id: 2e5de768-d259-11e2-be86-742f68828cd0
    Faulting package full name:
    Faulting package-relative application ID:
    I really hope to hear from someone soon, my job requires me to work with Photoshop every day and I run into errors and bugs almost constantly and all of the help I've received so far from people in my office doesn't seem to make much difference at all.  I'll be checking in regularly, so if you need any further details or need me to elaborate on anything, I should be able to get back to you fairly quickly.
    Thank you.

    Here you go Conroy.  These are probably a mess after various attempts at getting help.

  • Quicklook does not work with WMV files and quick look no longer maintains resized views when viewing from a folder using the up/down arrows

    Quicklook does not work with WMV files and quick look no longer maintains resized views when viewing from a folder using the up/down arrows. Any fixes?

    Same problem here...

  • Working with big files

    I would appreciate any suggestion as to how best one can work with big files.  I have eight one hour tapes containing information about various places I visited.  Some contain only one place while others can contain two or more places. As a preference I like to create up to one hour DVDs that contain an identifiable segment; eg either one place only or more but I do try not to break up a place and record it on two DVDs.  However, the problem I faced in the past, is that by the time I get to the end of an hour, the program Premiere Elements 7 (PE7) is getting slow and keeps telling me that it is running out of memory. That is despite the fact that I have 3 GM of RAM and over 200 GB of dedicated separate hard drive.  I tried saving segments under ‘Share’, ‘DV AVI’ and selecting ‘DV PAL Standard’ (the system I use), but the result, as far as quality was concerned, was very disappointing. There is no option to change or set quality as was the case in previous versions of PE.  Nor can I combine two .prel files into one while I am editing. 
    Is there any other way I can work in segments, say 15 minutes, and combine them at the end without losing on the quality? 
    Any suggestion would be most appreciated.
    Tom 

    Hi Steve
    It is a Sony DCR-HC40E PAL, and they were captured as AVI clips.
    The project settings are:
    General – not highlighted but it shows DV Pal and 25.00 frame/second
    Video – 720 horizontal 576vertical (4/3)
    Display format - 25 fps Timecode
    Capture – DV Capture
    Tom

  • Working with RAW files in PSE9:  Doable or better to use PSE12?

    I have PSE 9 and will soon get a camera with RAW capability.  I notice that Adobe no longer supports PSE 9.  Am I in for trouble if I don't upgrade to PSE 12 since I don't know how to work with RAW files?  It sounds as if I will need something to convert RAW files?  Where do I get it?  Is it a big deal for a beginner with no software skills?

    You can download a free DNG Converter from Adobe and then convert your RAWs to DNGs which can be used in PSE9.
    You don't need PSE12, but if you want to purchase PSE 12, you get the most current features in the Raw processor (which in my opinion is a huge improvement over what is available in PSE9), and you don't need the extra step of converting to DNG.

  • Working with RAW files in iPhoto 5.0.4 and Elements 4.0.1

    I take photos in RAW mode and download them to iPhoto. When I try to edit the photo in iPhoto, the picture is a tiny little file that is impossible to enlarge with any sort of clarity. Also, the word "RAW" does not appear anywhere on the iPhoto window like I read it is supposed to.
    When I drag the file to Photoshop Elements, I get an editing window that has none of the tools usually associated with JPEG files. I get a separate window in which I can darken or lighten the image, that's it.
    Clearly, I'm doing something wrong. No one in their right mind would ever use RAW if this is how it works.
    Any ideas?

    Hi Jack!
    If you're new working with RAW files, your right, it just doesn't make sense. RAW <imho> is a bit overrated. One thing you will need to keep in mind when shooting in RAW, is you will still need to take a well exposed image. What RAW files will allow are CHANGES in all areas of the image v. JPEG which may allow you to ADJUST a few settings in the image. My only suggestion would be to kepp playing around with PSE until you get the hang of it, it is an excellent image editing software. But realize, a well exposed JPEG and RAW file are hard to tell apart...
    Personally, I do not directly download RAW files through iPhoto but will create a folder and download to here, and simply drage folder to iPhoto to import (which are then 'converted' into JPEG files). This way I have the original RAW images safely located outside of iPhoto as well as in iPhoto. You should set Elements as your choice of application to edit files inside iPhoto.
    Good luck, Rick
    Good link: http://www.elementsvillage.com/forums/ and just for fun: http://www.photoshopcosmetics.com/index.php

Maybe you are looking for