How can I read generic-type object with object stream?

I declared a class like this
class Storage<K extedns Key, D extends Data> implements Serializable {
class Key implements Serializable {
interface Data extends Serializable {
}and I used ObjectOutputStream to save.
Storage<MyKey, MyData> storage = new Storage<MyKey, MyData>();
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File("file")));
out.writeObject(storage);after save code, I tryed to write loading code like
ObjectInputStream in = new ObjectInputStream(new FileInputStream(new File("file")));
Storage<MyKey, MyData> storage = (Storage<MyKey, MyData>)in.readObject();but, it occurs a casting error. How can I downcast my Object object to Storage<MyKey, MyData> object?

Gone are the days where one could achieve completely warning free code, it seems since generics has arrived. Is this an ideal compilation environment? What about the rest of us developers that have molded our processes into such where the resulting code compiled without deprecation warnings and all other such warnings? Why does it make us feel as though we're doing something wrong when we suppress a warning, when we really aren't because we know what we are suppressing? why doesn't it feel as squeaky clean as it once did? Are there plans to deal with this in the future or is this how we proceed to develop from now on?

Similar Messages

  • How can I read a blob created with ole container in forms 6i in forms 10g

    In forms 6i I used ole container to save a document (excel, pdf, word...) into a blob column.
    I want to migrate my application in forms 10g and I read that I have to use webutil_File_transfer.db_to_client and after webutil_host.blocking to see the document.
    In the same blob column I can have multiple type of document. How Can I know wich application to use to open the document ?
    Even if I know the extension of my document I'm enabled to open the file ???

    When you click a C/S OLE object, it is opened with its default application's owner, no ?
    So if the OLE object is opened by Excel, the extension is .xls.
    In any case you have to open the OLE object with its "mother" application if you want to save it as a file, so there is no problem at all to decide with extension to use.
    If you read this article : http://sheikyerbouti.developpez.com/webutil-docs/Webutil_store_edit_docs.htm you can see that the filename is automatically opened with the corresponding application.
    Francois

  • How can I read and display data with OR without recording at the same time?

    Hi all,
      This forum has been of much help to me, but I have a rather specific question I can't seem to find an answer to.  I am new to LabView, educating myself with tutorials, trial and error, and this forum. 
      Attached is what I have so far.  I would like to read data (three voltages) and write it to an excel file.  As written below, it will do nothing until I click the "Record" button, when it then takes data, displays it on the gauges and waveform chart, and writes it to a file.  What I would like it to do is display the data at all times, and record when I click the record button (while still displaying data being read).  I have tried to do this by moving the DAQ Assistant VI, gauges, and waveform graph outside of the loops, but when I do this, it will read until I press record, and then it simply records whatever value it's stuck on.  Sorry for the long post, thanks for any help. 
      --Nathan
    Attachments:
    Record and Write to File 2.vi ‏332 KB

    Sorry, I don't have any DAQ installed, so I won't comment on the DAQ parts.
    First of all, Your VI will do nothing until you (1) first set the record button to ON  and (2) press the start button in the tool bar. It almost seems that you are using the "continuous run" button. (Don't! That's not its purpose. Basically, it automatically restarts the program whenever it finishes). A toplevel VI should never stop during normal operation, so place a big while loop around all code and create a wait state that does nothing until you tell it to acquire.
    You don't need the inner while loop, simply place your code inside the big while loop (and accumulate your array data in an initialized shift register if really needed. Currently you do at the inner loop boundary for some reason). You have a big problem that the array can grow without bounds unless you clear the accumulated data once in a while or place it in a FIFO buffer of limited size. If you let ot grow forever like you do now, the program might run out of resources at one point in the future.
    Since you are appending to your file, maybe yo don't need any shift register, just use the data points of the current iteration. Place your save operations in a case structure and keep appending the new data to your file only if the case is true.
    It is also very inefficient to use highlevel file IO here,because each instance opens and closes the file. I recommend to open the file once outside the loop, then use low level IO to append, and close the file once the big loop is done.
    LabVIEW Champion . Do more with less code and in less time .

  • How can I read and type Burmese font on Apple devices .

    I would like to request Burmese font for Apple devices ( Mac Pro , iPhone ) as many Burmese are using apple . Please help me how to read Burmese font on iPhone and iPad .
    Thx

    T.T.win wrote:
    Are u honestly saying keyman app could help . I don't think it could work out for us .
    I suggested you try it.  That's the only way to find out whether it will meet your particular needs.

  • How can I read PDF bank statements with the new version of Firefox?

    After downloading the new Firefox, I can no longer see the PDF statements from my bank. What do I need to do to correct this?

    You can try this extension to override compatibility issues,
    * https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/
    Once it is installed, open Addons Manager and re-enable Webroot addon.
    Addons Manager URL: &nbsp;&nbsp;&nbsp;'''about:addons'''

  • How can I extend(resolve) a Path with a Stream of String

    I have following two variables;
    final Path root;   // /a/b/c final Stream<String> split; // 'd', 'e', 'f'  Path path;   // /a/b/c/d/e/f
    I want to resolve every element in split to the root.
    Currently I'm trying to do like this.
    // is the final combiner ok? final Path path = split.reduce(root, (p, s) -> p.resolve(s), (p1, p2) -> p1);
    Is this the right way? Is there any other way to do this?
    Is following code better than the above code?
    Path path = root; split.forEach(s -> path = path.resolve(s)); // path must be final?
    Thanks.

    dear friend,
    your 'key' transaction is SU01
    and please look here:
    http://help.sap.com/saphelp_47x200/helpdata/EN/52/671261439b11d1896f0000e8322d00/frameset.htm
    good luck!

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can i create a new user with only read rights ?

    How can i create a new user with only read rights ?

    You are asking about a Database User I hope.
    You can look into the Oracle 8i Documentation and find various privillages listed.
    In particular, you may find:
    Chapter 27 Privileges, Roles, and Security Policies
    an intresting chapter.
    You may want to do this with the various tools included with 8i - including the
    Oracle DBA Studio - expand the Security node and you can create USERS and ROLES.
    Or use SQL*Plus. To create a
    user / password named John / Smith, you would login to SQL*Plus as System/manager (or other) and type in:
    Create user John identified by Smith;
    Grant CONNECT to John;
    Grant SELECT ANY TABLE to John;
    commit;
    There is much more you can do
    depending on your needs.
    Please read the documentation.
    -John
    null

  • How can I sync my various email accounts into an iCloud account.  Example.  I have an embarqmail.account.  How can I get it to sync with iPhone, iPad, iMac so that I don't have to read or review eMails on all 3 devices.  Thanks

    How can I sync my various email accounts into an iCloud account.  Example.  I have an embarqmail.account.  How can I get it to sync with iPhone, iPad, iMac so that I don't have to read or review eMails on all 3 devices.  Thanks

    You need OSX 10.7.2 or higher in order to access icloud.  The mobile me account is now defunct (it closed down more than a year ago).

  • How can I read pdf with ebook reader on JounE touch

    How can I read pdf with ebook reader and where could I put the pdf in Journe

    Hi there
    You said that you want to read pdf with ebook reader .
    For me ,i usually read the pdf files using another pdf reader which supports to read the pdf files directly.
    And i am now just using their free trial.
    You can also have a try.
    +Message was edited: Advert has been removed+

  • How can i read Object serialized in delphi ?

    anyone has got any ideas how can i read serialized object created by delphi and was serialized in a file

    zeda wrote:
    Peter__Lawrey wrote:
    To my knowledge you need a Delphi program to read it.so there is no 3rd party plugin or so?Not that I know of. You could learn more about how Delphi serializes objects, and work back from there. But you're probably much better off taking a hint from Peter and serializing to XML in the first place. This sort of problem is the exact kind of thing XML is good at solving

  • Email messages from my icloud account update on all my devices showing if they have been read and if a reply has been sent.  This does not happen with my tinyworld (TalkTalk) email account.  Can I (how can I) get this to work with TinyWorld?

    Email messages from my icloud account update on all my devices showing if they have been read and if a reply has been sent.  This does not happen with my tinyworld (TalkTalk) email account.  Can I (how can I) get this to work with TinyWorld?

    You have to look at the email protocol being used.  the Apple email system uses IMAP, does Tinyworld use IMAP or POP?
    Does the email system permit delivery receipts to be requested?
    Just some of the things one needs to determine from the information provided by the email service provider.

  • I downloaded the ipad app for kindle, my wife has the app on her iphone also with several books that she has downloaded to her iphone, how can i read these books on my ipad?

    I downloaded the ipad app for kindle, my wife has the app on her iphone also with several books that she has downloaded to her iphone, how can i read these books on my ipad?

    By sharing the same Amazon account on each device. You may also have to use the same Apple ID and password.

  • How can I read my Ibooks saved on an Ipad on a PC with windows 7??

    Hi,
    How can I read information saved on IBooks on an Ipad on to a PC with Windows 7? How can the devices (PC and IPad) be synchronised, in a similar manner to the way emails are linked?

    http://lmgtfy.com/?q=read+ibook+on+pc

  • How can I read the PXI-Chassis-Type (LabWindows/CVI)?

    How can I read the PXI-Chassis-Type?
    I use in different test-stands different PXI/SCXI-Chassis for the same project. For example: Some test-stands have a PXI/SCXI-1052-Chassis, others have a PXI-1033 and a SCXI-1000 Chassis. Because I have to use different DIO-Ports (Ports 0.0, 0.1... are reserved for internal communication between the 1033 and the 1000-Chassis) I want to read the used devices.
    I think one way is to use the registry-entries, but I'm not sure...
    My current LabWindows/CVI- version is 8.5.1.
    Thanks for your ideas!
    Jagger_HKG

    Hello Jagger_HKG,
    you could use the NI System Configuration API.
    Kind regards,
    Robert H
    NI Germany 

Maybe you are looking for

  • Which table or view is the PO total

    I am trying to modify the Printed Purchase Order Report(Portrait) POXPRPOP Can some one tell me which table the po total are stored for both blanket & standard po's.

  • My system boots normally only half the time

    Hello, I've been trying to properly boot all day and nothing has worked. Symptom: Boots to a blue screen no pinwheel or anything. It froze while working, the pinwheel and everything froze. So I turned it of and on. Now it won't boot normally. The onl

  • How to connect an angular encoder to NI9401 for velocity?

    I have an angular encoder connected to a NI9401 daq. I put line A of the encoder to one of the digital inputs and the same with line Z (line B is not conected because direction is not relevant). However I'm having a hard time trying to get the veloci

  • How to set different sounds for different events?

    Hello I had Xiaomi Mi2s before and I could set different sound for every email account I had, for sms, for facebook and so on. How do I do it on my Xperia? Of course that for example SMS is more important then some facebook comment, so I would like t

  • Customizing cursor positioning in the delivery

    We are currently running SAP 4.6C with support pack level 48. We recently upgraded from support pack 29. Per OSS note 507967 which was applied per support pack 32, the cursor on all tabs under the Delivey Overview screen is placed on the first open l