View Javadoc
1   /*
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2026, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v2.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.classic.kryo;
15  
16  public class KryoClassicConstants {
17  
18  
19      public static final int DEFAULT_MAX_EVENTS_BEFORE_RESET = 8*1024;
20  
21      /** Magic identifying a Kryo event stream. */
22      public static final byte[] STREAM_MAGIC = { 'S', 'T', 'W', 'D' };
23  
24      /**
25       * Version 0: Vanilla, i.e. Kryo's default serializers. Event payloads are not framed.
26       */
27      public static final byte STREAM_VERSION_0 = 0;
28  
29      /**
30       * Version 5: Custom uses {@link LoggingEventKryoVOSerializerV5} (presence bitmap,
31       * packed epoch-second/nanos delta, shared long-string serializer). Event payloads
32       * are framed ({@link StreamFrameV5}).
33       */
34      public static final byte STREAM_VERSION_5 = 5;
35  
36  
37      /** Size of the fixed stream header: magic (4) + version (1) + flags (1). */
38      public static final int STREAM_HEADER_SIZE = 6;
39  
40      /** True when the body after the stream header uses framed EVENT/CLOSE records. */
41      public static boolean isFramed(byte streamVersion) {
42          return streamVersion == STREAM_VERSION_5;
43      }
44  
45      /** Flag bit: Custom serializers (unset means Vanilla). */
46      public static final byte FLAG_CUSTOM_SERIALIZER = 0x01;
47  
48  }