java - How to convert from TimePrimitive to int? -
I have some data values (type-time-permitive) that I need to write in a file, but method out. ) Only takes the parameter as int, so I need to find a way to convert my values to int
I think this is a wrong approach. If you want to write objects in a file, To write not have to use Objektotputstrym:
FileOutputStream fos = new FileOutputStream ( "t.tmp"); ObjectOutputStream OOS = New ObjectOutputstream (fos); Oos.writeInt (12345); Oos.writeObject ("Today"); Oos.writeObject (new date ()); Oos.writeObject (myTimePrimitive); Oos.close (); Normal Out. Written (int) is used to write a plain byte in a stream, and this object will be used by the overtputed stream class.
You can use ObjectInputStream to read your object again.
Comments
Post a Comment