MCPcopy Create free account
hub / github.com/MenoData/Time4J / readDate

Method readDate

base/src/main/java/net/time4j/SPX.java:295–322  ·  view source on GitHub ↗
(
        DataInput in,
        byte header
    )

Source from the content-addressed store, hash-verified

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 {

Callers 2

readExternalMethod · 0.95
readTimestampMethod · 0.95

Calls 2

ofMethod · 0.95
valueOfMethod · 0.95

Tested by

no test coverage detected