ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/tribes/UniqueId.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/tribes/UniqueId.java
Status
scanned
Type
file
Name
UniqueId.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2324 (2.3 KB)
MD5
628b112e872fc7df3306b2dcc752a4d5
SHA1
63d1136248182bdbe1768eb5c1b6908e398ec915
SHA256
204572f65701337e15b83b4fccb79f57428d175a80c1bc53f6d83096476fa128
SHA512

      
    
SHA1_git
c94392c85d4e4e3238f3d89cb48edf8c83bf47e1
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
UniqueId.java | 2.3 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.tribes; import java.io.Serial; import java.io.Serializable; import org.apache.catalina.tribes.util.Arrays; /** * Represents a globally unique Id. */ public final class UniqueId implements Serializable { @Serial private static final long serialVersionUID = 1L; final byte[] id; public UniqueId() { this(null); } public UniqueId(byte[] id) { this.id = id; } public UniqueId(byte[] id, int offset, int length) { this.id = new byte[length]; System.arraycopy(id, offset, this.id, 0, length); } @Override public int hashCode() { if (id == null) { return 0; } return Arrays.hashCode(id); } @Override public boolean equals(Object other) { boolean result = (other instanceof UniqueId); if (result) { UniqueId uid = (UniqueId) other; if (this.id == null && uid.id == null) { // Nothing to do } else if (this.id == null) { result = false; } else if (uid.id == null) { result = false; } else { result = Arrays.equals(this.id, uid.id); } } return result; } public byte[] getBytes() { return id; } @Override public String toString() { return "UniqueId" + Arrays.toString(id); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
44.4
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9