(Field field, Object o)
| 255 | } |
| 256 | |
| 257 | private void field(Field field, Object o) |
| 258 | throws IOException, IllegalArgumentException, IllegalAccessException, |
| 259 | ClassNotFoundException |
| 260 | { |
| 261 | Class type = field.getType(); |
| 262 | if (!type.isPrimitive()) { |
| 263 | field.set(o, readObject()); |
| 264 | } else { |
| 265 | if (type == Byte.TYPE) { |
| 266 | field.setByte(o, (byte)rawByte()); |
| 267 | } else if (type == Character.TYPE) { |
| 268 | field.setChar(o, (char)rawShort()); |
| 269 | } else if (type == Double.TYPE) { |
| 270 | field.setDouble(o, Double.longBitsToDouble(rawLong())); |
| 271 | } else if (type == Float.TYPE) { |
| 272 | field.setFloat(o, Float.intBitsToFloat(rawInt())); |
| 273 | } else if (type == Integer.TYPE) { |
| 274 | field.setInt(o, rawInt()); |
| 275 | } else if (type == Long.TYPE) { |
| 276 | field.setLong(o, rawLong()); |
| 277 | } else if (type == Short.TYPE) { |
| 278 | field.setShort(o, (short)rawShort()); |
| 279 | } else if (type == Boolean.TYPE) { |
| 280 | field.setBoolean(o, rawByte() != 0); |
| 281 | } else { |
| 282 | throw new IOException("Unhandled type: " + type); |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | public Object readObject() throws IOException, ClassNotFoundException { |
| 288 | int c = rawByte(); |
no test coverage detected