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

Method readDayPeriod

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

Source from the content-addressed store, hash-verified

578 }
579
580 @SuppressWarnings("unchecked")
581 private Object readDayPeriod(
582 ObjectInput in,
583 byte header
584 ) throws IOException, ClassNotFoundException {
585
586 boolean fixed = ((header & 1) == 1);
587 boolean custom = ((header & 2) == 2);
588
589 if (custom) {
590 Map<PlainTime, String> timeToLabels = (Map<PlainTime, String>) in.readObject();
591 return new DayPeriod.Element(fixed, DayPeriod.of(timeToLabels));
592 }
593
594 String langCode = in.readUTF();
595 String calendarType = in.readUTF();
596 int index = langCode.indexOf("-");
597 Locale locale;
598
599 if (index == -1) {
600 locale = new Locale(langCode);
601 } else {
602 locale = new Locale(langCode.substring(0, index), langCode.substring(index + 1));
603 }
604
605 return new DayPeriod.Element(fixed, locale, calendarType);
606
607 }
608
609 private void writeMachineTime(ObjectOutput out)
610 throws IOException {

Callers 1

readExternalMethod · 0.95

Calls 2

ofMethod · 0.95
readObjectMethod · 0.45

Tested by

no test coverage detected