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

Method readObject

CodenameOne/src/com/codename1/io/Util.java:1100–1256  ·  view source on GitHub ↗
(DataInputStream input)

Source from the content-addressed store, hash-verified

1098 ///
1099 /// - `IOException`: thrown by the stream
1100 public static Object readObject(DataInputStream input) throws IOException {
1101 try {
1102 if (!input.readBoolean()) {
1103 return null;
1104 }
1105 String type = input.readUTF();
1106 if ("int".equals(type)) {
1107 return input.readInt();
1108 }
1109 if ("byte".equals(type)) {
1110 return input.readByte();
1111 }
1112 if ("short".equals(type)) {
1113 return input.readShort();
1114 }
1115 if ("long".equals(type)) {
1116 return input.readLong();
1117 }
1118 if ("float".equals(type)) {
1119 return input.readFloat();
1120 }
1121 if ("double".equals(type)) {
1122 return input.readDouble();
1123 }
1124 if ("bool".equals(type)) {
1125 return input.readBoolean();
1126 }
1127 if ("String".equals(type)) {
1128 return input.readUTF();
1129 }
1130 if ("Date".equals(type)) {
1131 return new Date(input.readLong());
1132 }
1133
1134 if ("ObjectArray".equals(type)) {
1135 Object[] v = new Object[input.readInt()];
1136 int vlen = v.length;
1137 for (int iter = 0; iter < vlen; iter++) {
1138 v[iter] = readObject(input);
1139 }
1140 return v;
1141 }
1142 if ("ByteArray".equals(type)) {
1143 byte[] v = new byte[input.readInt()];
1144 input.readFully(v);
1145 return v;
1146 }
1147 if ("LongArray".equals(type)) {
1148 long[] v = new long[input.readInt()];
1149 int vlen = v.length;
1150 for (int iter = 0; iter < vlen; iter++) {
1151 v[iter] = input.readLong();
1152 }
1153 return v;
1154 }
1155 if ("ShortArray".equals(type)) {
1156 short[] v = new short[input.readInt()];
1157 int vlen = v.length;

Callers 15

internalizeMethod · 0.95
internalizeMethod · 0.95
readObjectMethod · 0.95
internalizeMethod · 0.95
readResponseMethod · 0.95
getExpiryTimesMethod · 0.45
getListenerClassMethod · 0.45
getActiveKeysMethod · 0.45
getActiveFencesMethod · 0.45
getFencesMethod · 0.45
getImageDataMethod · 0.45

Calls 15

putMethod · 0.95
createMethod · 0.95
newInstanceMethod · 0.95
internalizeMethod · 0.95
getPropertyIndexMethod · 0.95
eMethod · 0.95
asExternalizableMethod · 0.80
readBooleanMethod · 0.65
readUTFMethod · 0.65
equalsMethod · 0.65
readIntMethod · 0.65
readByteMethod · 0.65

Tested by 9

loadCurrentScriptMethod · 0.36
loadCurrentOutputMethod · 0.36
loadCurrentCssMethod · 0.36
loadModeMethod · 0.36
loadDeviceMethod · 0.36
loadOrientationMethod · 0.36
loadPanelMethod · 0.36
loadHistoryMethod · 0.36