How to save an "Object" in a selected file ?

Hi,
I would like to save an object with for example a PlanarImage object type in a selected file from JFileChooser
Do you know how to do it ?
I tried this but it didn't work :
File fChoosen = chooser.getSelectedFile();
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(fChoosen));
os.flush();
os.writeObject(planImage); //write the planarImage
os.close();
Thanks a lot !

Is "PlanarImage" one of your classes? If so, it has to implement the Serializable interface if you want to write it like that.

Similar Messages

  • How to save passwords. Setting already selected but still does not save.

    How to save passwords. Setting already selected but still does not save. Web site does allow password saving.

    Could you try a fake username and password on another site, and see if you can save there? You can use this website's login form at [https://support.mozilla.com/tiki-login.php] to test.
    Let me know the result of doing this, and whether any password-related errors appear in Tools->Error Console

  • How can I save an object Image in a file with .jpg or .gif format?

    Greetings
    I'm programming a Ray Tracer but now I need to know like save an object Image in a file with .jpg or .gif format. Could anyone help me, please? It's very important to me do this as soon as possible. Thanks.

    In 1.4 you have ImageIO available ... javax.imageio.ImageIO.write is the method to call.
    - David

  • How to save Internal table as a local file?

    Hi,
    How to save Interanl table as a local file ?
    I had some data which i had selected in Interanl table and would like to send this as an attachment by attaching internal table contents as a local file--

    Hi friend,
    See sample code for GUI_DOWNLOAD.
    *Types
    TYPES: BEGIN OF g_r_mara,
           matnr LIKE mara-matnr,
           ersda LIKE mara-ersda,
           laeda LIKE mara-laeda,
           mtart LIKE mara-mtart,
           mbrsh LIKE mara-mbrsh,
           END OF g_r_mara.
    *Data
    DATA: g_t_mara TYPE TABLE OF g_r_mara,
          filename TYPE string.
    *Tables
    TABLES: mara, sscrfields.
    *Selection Screen
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN COMMENT 10(20) text-001 FOR FIELD p1.
    SELECTION-SCREEN PUSHBUTTON 12(20) word USER-COMMAND uc.
    SELECTION-SCREEN END OF LINE.
    *Initilizing data.
    INITIALIZATION.
      word = 'word'.
      filename = 'C:\Testing.doc'.   <------- File name and location
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
        WHEN 'UC'.
    *Data retrival
          SELECT matnr ersda laeda mtart mbrsh
            INTO  CORRESPONDING FIELDS OF TABLE g_t_mara
            FROM mara
            WHERE matnr IN s_matnr.
    *Downloading data from internal table to excel
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename              = filename
              filetype              = 'ASC'
              write_field_separator = 'X'
            TABLES
              data_tab              = g_t_mara.
      ENDCASE.
    (Note: Downloaded file is in C:\Testing.doc)
    You can change the file format by changing the extension in filename.
    Might helpful for u.
    Thanks..

  • Linux server(how to save command out put to another file. )

    hi all,
    i have Q ?
    how to save command out put to another file.
    Ex: #ps -ef
    that particular cmd output i need to save another file.
    is it possible ...if possible ..please let me know
    And how to save command history in Linux.

    df -h >> /oracle/output.log
    /oracle -- mount point name
    Regards
    Asif Kabir

  • ANYBODY KNOW how to save a swatch in an ID file at a percentage?

    ANYBODY KNOW how to save a swatch in an ID file at a percentage?
    So that every time it's used, it applies that percentage automatically?

    LOL...nevermind. Took me 2 seconds to realize all I needed to do after posting this. Sad trombone.

  • How to save a variant with dynamic selections parameters

    Anybody knows how to save a variant for an ABAP that uses a Logical database with Dynamic Selections?
    Have a look for example to the following:
    SE38 - DEMO_PROGRAM_GET - Execute - Shift F4 - Connection Number.
    How to save 0820 as Connection Number?
    Function Group SVAR seems good but FREE SELECTIONs are not easy to manage...

    Hello,
      I tried to save the variant of DEMO_PROGRAM_GET with dynamic selection field (Connection Number) filled. It gets saved without any problem. Just click 'SAVE' and enter the variant name and description.
    Thanks,
    Venu

  • How to save an object with JSTL

    I have an object, how to save it with JSTL?
    I have this
    public class Auto{
    private AutoBomba a;
    public AutoBomba getA()
    return this.a;
    public AutoBomba setA(AutoBomba a)
    this.a = a;
    How can I set the from a JSP page a AutoBomba? The objects name is only for example

    There is of course the JSTL c:set tag
    This relies on the appropriate variables being in JSTL scope.
    <jsp:useBean id="auto" class="com.mypackage.Auto" scope="request"/>
    <jsp:useBean id="bomba" class = "com.mypackage.AutoBomba"/>
    <c:set target="auto" property="a" value="${bomba}"/>Cheers,
    evnafets

  • How to close the object after generation Excel file

    I have generated excel file. I save that file using "Save" button on dialog-box. After i go to menu navigation at that time i got javascript error.
    please give me the solution how to close objects after generating excel file.

    Hi,
    Pls don't forget to reward points and close the question if you find the answers useful.
    Eddy

  • How to save the RichTextBox Content in Text file

    hI ,
    I NEED TO SAVE THE RichTextBox Content in text file ? 

    If this IS a LabVIEW question, here's an example of how to load a rich text file (to help if you don't know how to get a rich text in LabVIEW).
    If you have a Rich Text Box, you can use the invoke method "SaveFile" to match the function you linked to.

  • How to save a form in a different file name?

    Hello All,
    I have a form which has 7 pages. I have 3 buttons which are for submitting PDF,XML and print button. I do not want to keep SaveAs button.
    What I need : When the user completes all the required fields and clicks on SubmitAsPDF or SubmitAsXML then it will prompt the user to save the form in a different file name. After the user has saved the form in a different file name then it should submit the form to the required mail ID. How to best accomplish it ?
    Thanks.
    Bibhu.

    Hello Niall,
    Thanks for the help. I used a hidden field whose name is "CurrentFileName" then in the docReady event of this hidden field I used the following script.
    this.rawValue = event.target.documentFileName;
    Then in the mouseUp event of the submit button I used the follwing script.
    if(form1.Page1.CurrentFileName.rawValue == event.target.documentFileName)
                             app.alert("Please save this form in a different file name before submitting !");
                             app.execMenuItem("SaveAs");
    But problem is : As the file is saved in a different name the script fires again and again if we click the submit button prompting the user to save the form in a different file name , but the user has already saved it in different file name .How to get rid of it ?
    Thanks.
    Bibhu.

  • How to save the audio bytes in a file

    I am capturing the audio from microphone.I write the audio data as bytes to other clients.How can i save the bytes in a wav file and it can be played in future?Please help.I want to write the audio bytes in a wav file

    get sample source code from
    http://javasolution.blogspot.com/2007/04/record-and-save-audio-using-java.html

  • How to save for web AND overwrite original files with Action?

    Hello,
    I want to compress a batch of images with "save for web" using a Photoshop Action, and I also want to preserve my folder structure and overwrite source files. The structure is important because it's complex and needs to be structured this way.
    The Problem:
    When I choose "save for web", I must define a destination. What happens is all optimized files from within the structure are saved in a single location.
    Here's an example of the folder structure
    Folder A
         - Subfolder A1
         - Subfolder A2
    Folder B
         - Subfolder B1
         - Subfolder B2
              -Subfolder B2.2
    Folder C
         -Subfolder C1
    Summary
    Is it possible for me to use a Photoshop Action with "save for web", and overwrite my files without moving them from the structure?

    No need to re-invent the wheel.
    Just learn how to use the Image Processor, Image Processor Pro, or Dr. Brown's Services 1-2-3 in Photoshop and/or Bridge.

  • How to create an object of a binary file?

    Does anyone know how I may create a serializable object of a binary file?
    Thanks.

    Sorry for the late reply.
    No, I'm not trying to deserialise a serialised object. My intent is to create a serialisable object from a binary file and then store this object in a JMS Queue.
    One option is to create a byte array of the binary file. Wondering if there are other options available.

  • How to save VISA information into a configuration file

    Hi guys,
    I've got a problem that i can't quite figure out and I'm sure someone else has done this but i have searched the forums and didn't find anything suitable myself.
    I'm trying to save configuration files for my program and then reload them back in so that i can get the same state of the controls.  One of the controls I'd like to save into the configuration file is a VISA control.  has anyone figured out how to save this into configuration files?  I know that OpenG has a write variant to config but Id like to stay away from 3rd party stuff as much as possible.  Does anyone have any suggestions as to how to get around this?
    Thanks
    Brent 
    Solved!
    Go to Solution.

    The alternative to Write Keys, if you don't want a text file, is a BIN file. I do it this way when I don't want users poking around text file trying to change things, and/or for security. And it's fast.
    The attached picture shows, in general, how to do it.
    Richard
    Attachments:
    saveSettings.gif ‏11 KB

Maybe you are looking for