- Timestamp:
- 2024-06-03T18:08:14+02:00 (8 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r19080 r19096 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException;7 import java.io.ObjectInputStream;8 import java.io.ObjectOutputStream;9 6 import java.text.MessageFormat; 10 7 import java.time.Instant; … … 143 140 * Other bits of this field are used in subclasses. 144 141 */ 145 pr ivatevolatile short flags = FLAG_VISIBLE; // visible per default142 protected volatile short flags = FLAG_VISIBLE; // visible per default 146 143 147 144 /** … … 372 369 updateFlags(flag, value); 373 370 return oldFlags != flags; 374 }375 376 /**377 * Write common data to a serialization stream. At time of writing, this should <i>only</i> be used by {@link PrimitiveData}.378 * @param oos The output stream to write to379 * @throws IOException see {@link ObjectOutputStream#write}380 */381 protected void writeObjectCommon(ObjectOutputStream oos) throws IOException {382 oos.writeLong(id);383 oos.writeLong(user == null ? -1 : user.getId());384 oos.writeInt(version);385 oos.writeInt(changesetId);386 oos.writeInt(timestamp);387 oos.writeObject(keys);388 oos.writeShort(flags);389 }390 391 /**392 * Read common data from a serialization stream. At time of writing, this should <i>only</i> be used by {@link PrimitiveData}.393 * @param ois The serialization stream to read from394 * @throws ClassNotFoundException see {@link ObjectInputStream#readObject()}395 * @throws IOException see {@link ObjectInputStream#read}396 */397 protected void readObjectCommon(ObjectInputStream ois) throws ClassNotFoundException, IOException {398 id = ois.readLong();399 final long userId = ois.readLong();400 user = userId == -1 ? null : User.getById(userId);401 version = ois.readInt();402 changesetId = ois.readInt();403 timestamp = ois.readInt();404 keys = (String[]) ois.readObject();405 flags = ois.readShort();406 371 } 407 372 -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
r19078 r19096 84 84 85 85 private void writeObject(ObjectOutputStream oos) throws IOException { 86 // since super class is not Serializable 87 super.writeObjectCommon(oos); 86 oos.writeLong(id); 87 oos.writeLong(user == null ? -1 : user.getId()); 88 oos.writeInt(version); 89 oos.writeInt(changesetId); 90 oos.writeInt(timestamp); 91 oos.writeObject(keys); 92 oos.writeShort(flags); 88 93 oos.defaultWriteObject(); 89 94 } 90 95 91 96 private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { 92 // since super class is not Serializable 93 super.readObjectCommon(ois); 97 id = ois.readLong(); 98 final long userId = ois.readLong(); 99 user = userId == -1 ? null : User.getById(userId); 100 version = ois.readInt(); 101 changesetId = ois.readInt(); 102 timestamp = ois.readInt(); 103 keys = (String[]) ois.readObject(); 104 flags = ois.readShort(); 94 105 ois.defaultReadObject(); 95 106 }
Note:
See TracChangeset
for help on using the changeset viewer.