Results 1 to 2 of 2
  1. #1
    urbanleg is offline Member
    Join Date
    Jul 2011
    Posts
    25
    Rep Power
    0

    Default I need to keep a whole file as a serializable class field

    Hi.
    i need to save a file (zip file \ jpg ) in a serializable class

    what type of field should i use?
    obviously "FILE" is not good since it keeps the adress of the file only
    i want to be able to send this serializable class via tcp to a server for further processing..

    thanks

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by urbanleg View Post
    Hi.
    i need to save a file (zip file \ jpg ) in a serializable class

    what type of field should i use?
    obviously "FILE" is not good since it keeps the adress of the file only
    i want to be able to send this serializable class via tcp to a server for further processing..

    thanks
    Use a simple byte[] (it is Serializable) and make your Zip stream write to a ByteArrayOutputStream ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. marking a field Serializable
    By user1234 in forum Advanced Java
    Replies: 9
    Last Post: 05-18-2010, 11:27 AM
  2. How can I share a static field between 2 class loaders?
    By zibilico in forum Advanced Java
    Replies: 6
    Last Post: 03-09-2010, 01:31 PM
  3. can I use scanner as class field?
    By gcampton in forum New To Java
    Replies: 13
    Last Post: 11-10-2009, 02:07 PM
  4. Class Reflection: Finding field infomation
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-23-2008, 08:09 PM
  5. Getting class field information using Reflection
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-24-2008, 03:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •