MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / writeObject

Method writeObject

CodenameOne/src/com/codename1/io/Util.java:660–883  ·  view source on GitHub ↗
(Object o, DataOutputStream out)

Source from the content-addressed store, hash-verified

658 ///
659 /// - `IOException`: thrown by the stream
660 public static void writeObject(Object o, DataOutputStream out) throws IOException {
661 if (o == null) {
662 out.writeBoolean(false);
663 return;
664 }
665 out.writeBoolean(true);
666 if (o instanceof Externalizable) {
667 Externalizable e = (Externalizable) o;
668 out.writeUTF(e.getObjectId());
669 out.writeInt(e.getVersion());
670 e.externalize(out);
671 return;
672 }
673 if (o instanceof PropertyBusinessObject) {
674 Externalizable e = ((PropertyBusinessObject) o).getPropertyIndex().asExternalizable();
675 out.writeUTF(e.getObjectId());
676 out.writeInt(e.getVersion());
677 e.externalize(out);
678 return;
679 }
680
681 if (o instanceof Vector) {
682 Vector v = (Vector) o;
683 out.writeUTF("java.util.Vector");
684 int size = v.size();
685 out.writeInt(size);
686 for (int iter = 0; iter < size; iter++) {
687 writeObject(v.elementAt(iter), out);
688 }
689 return;
690 }
691
692 if (o instanceof Set) {
693 Collection v = (Collection) o;
694 out.writeUTF("java.util.Set");
695 int size = v.size();
696 out.writeInt(size);
697 for (Object cur : v) {
698 writeObject(cur, out);
699 }
700 return;
701 }
702
703 if (o instanceof Collection) {
704 Collection v = (Collection) o;
705 out.writeUTF("java.util.Collection");
706 int size = v.size();
707 out.writeInt(size);
708 for (Object cur : v) {
709 writeObject(cur, out);
710 }
711 return;
712 }
713
714 if (o instanceof Hashtable) {
715 Hashtable v = (Hashtable) o;
716 out.writeUTF("java.util.Hashtable");
717 out.writeInt(v.size());

Callers 15

externalizeMethod · 0.95
externalizeMethod · 0.95
writeObjectMethod · 0.95
externalizeMethod · 0.95
buildRequestBodyMethod · 0.95
internalizeVersion2Method · 0.95
internalizeVersion3Method · 0.95
updateExpiryTimesMethod · 0.45
purgeExpiredMethod · 0.45
setListenerClassMethod · 0.45
saveActiveKeysMethod · 0.45

Calls 15

hasMoreElementsMethod · 0.95
nextElementMethod · 0.95
booleanValueMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
isOpaqueMethod · 0.95
getImageDataMethod · 0.95
instanceofObjArrayMethod · 0.95
instanceofByteArrayMethod · 0.95
instanceofShortArrayMethod · 0.95
instanceofDoubleArrayMethod · 0.95
instanceofFloatArrayMethod · 0.95

Tested by 9

internalizeVersion2Method · 0.76
internalizeVersion3Method · 0.76
saveCurrentStateMethod · 0.36
saveModeMethod · 0.36
saveDeviceMethod · 0.36
saveOrientationMethod · 0.36
savePanelMethod · 0.36
pushHistoryMethod · 0.36