cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Schröder <>
Subject AW: AW: Store BitSet
Date Mon, 12 Mar 2007 08:26:45 GMT
hi peter :-)

this is the exact same way we use it to store generic serializable java-objects in our db.

//is closing necessary: (?)

YES, you should always close streams. its almost done bye the runtime, but you cannot be sure.

kind regards

-----Ursprüngliche Nachricht-----
Von: Peter Karich [] 
Gesendet: Freitag, 9. März 2007 21:41
Betreff: Re: AW: Store BitSet

Hi, Peter Schröder!

> you may use 
> to serialize any given object. but i guess thats not what you want. 
Ah thank you! with the addition of ByteArrayOutputStream it is very easy:

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(new BitSet());
byte array[] = baos.toByteArray();
writeProperty(BIT_SET_PROPERTY, array);

ByteArrayInputStream bais = new

ObjectInputStream o = new ObjectInputStream(bais);
BitSet date = (BitSet) o.readObject();

//is closing necessary: (?)

Thank you again and sorry for this not-cayenne-related question,

Peter Karich.

Telefonate ohne weitere Kosten vom PC zum PC:

View raw message