(
DataInput in,
byte header
)
| 293 | } |
| 294 | |
| 295 | private PlainDate readDate( |
| 296 | DataInput in, |
| 297 | byte header |
| 298 | ) throws IOException { |
| 299 | |
| 300 | int month = header & 0xF; |
| 301 | int header2 = in.readByte(); |
| 302 | int range = (header2 >> 5) & 3; |
| 303 | int day = header2 & 31; |
| 304 | int year; |
| 305 | |
| 306 | switch (range) { |
| 307 | case 1: |
| 308 | year = in.readByte() + 1850 + 128; |
| 309 | break; |
| 310 | case 2: |
| 311 | year = in.readShort(); |
| 312 | break; |
| 313 | case 3: |
| 314 | year = in.readInt(); |
| 315 | break; |
| 316 | default: |
| 317 | throw new StreamCorruptedException("Unknown year range."); |
| 318 | } |
| 319 | |
| 320 | return PlainDate.of(year, Month.valueOf(month), day); |
| 321 | |
| 322 | } |
| 323 | |
| 324 | private void writeTime(DataOutput out) |
| 325 | throws IOException { |
no test coverage detected