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

Method readDuration

base/src/main/java/net/time4j/SPX.java:527–549  ·  view source on GitHub ↗
(
        ObjectInput in,
        byte header
    )

Source from the content-addressed store, hash-verified

525 }
526
527 private Object readDuration(
528 ObjectInput in,
529 byte header
530 ) throws IOException, ClassNotFoundException {
531
532 boolean useLong = ((header & 0xF) == 1);
533 int size = in.readInt();
534
535 if (size == 0) {
536 return Duration.ofZero();
537 }
538
539 List<TimeSpan.Item<IsoUnit>> items = new ArrayList<>(size);
540
541 for (int i = 0; i < size; i++) {
542 long amount = (useLong ? in.readLong() : in.readInt());
543 IsoUnit unit = (IsoUnit) in.readObject();
544 items.add(TimeSpan.Item.of(amount, unit));
545 }
546
547 boolean negative = in.readBoolean();
548 return new Duration<>(items, negative);
549 }
550
551 private void writeDayPeriod(ObjectOutput out)
552 throws IOException {

Callers 1

readExternalMethod · 0.95

Calls 4

ofZeroMethod · 0.95
ofMethod · 0.65
readObjectMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected