{"success":true,"data":{"ext":"class","name":"Java bytecode file","description":"Java bytecode class files are compiled program files defined by Sun Microsystems and maintained by Oracle as part of the Java platform. They are used to distribute Java application and library code for execution by the Java Virtual Machine on desktop, server, embedded, and mobile systems. Because they contain executable instructions, class files should be treated as code from untrusted sources and inspected before loading into tools or runtime environments.","mime":["application/java-vm"],"risk_level":"Safe","signatures":[{"hex":"CA FE BA BE","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"},{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"},{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]}],"related":["jar","aar","apk","dex"],"usage":{"python":"def is_class(file_path: str) -> bool:\n    \"\"\"Check if file is a valid CLASS by magic bytes.\"\"\"\n    signature = bytes([0xCA, 0xFE, 0xBA, 0xBE])\n    with open(file_path, \"rb\") as f:\n        return f.read(4) == signature","node":"function isCLASS(buffer: Buffer): boolean {\n  const signature = Buffer.from([0xCA, 0xFE, 0xBA, 0xBE]);\n  return buffer.subarray(0, 4).equals(signature);\n}","go":"func IsCLASS(data []byte) bool {\n    signature := []byte{0xCA, 0xFE, 0xBA, 0xBE}\n    if len(data) < 4 {\n        return false\n    }\n    return bytes.Equal(data[:4], signature)\n}"},"category":"Executables"}}