网上书城网站开发意义网站和搜索引擎

news/2025/10/2 1:09:48/文章来源:
网上书城网站开发意义,网站和搜索引擎,想做运营怎么入手,如何才能看到国外的设计网站解析class文件案例介绍本案例主要介绍通过java代码从class文件中解析#xff1b;class文件、常量池、属性表#xff1b;作为类(或者接口)信息的载体#xff0c;每个class文件都完整地定义了一个类。为了使java程序可以“编写一次#xff0c;处处运行”#xff0c;Java虚拟…解析class文件案例介绍 本案例主要介绍通过java代码从class文件中解析class文件、常量池、属性表作为类(或者接口)信息的载体每个class文件都完整地定义了一个类。为了使java程序可以“编写一次处处运行”Java虚拟机规范对class文件格式进行了严格的规定。但是另外一方面对于从哪里加载class文件给了足够多的自由。Java虚拟机实现可以从文件系统读取和从JAR(或ZIP)压缩包中提取clss文件。除此之外也可以通过网络下载、从数据库加载甚至是在运行中直接生成class文件。Java虚拟机规范中所指的class文件并非特指位于磁盘中的.class文件而是泛指任何格式符号规范的class数据。环境准备 jdk 1.8.0 IntelliJ IDEA Community Edition 2018.3.1 x64配置信息 配置位置Run/Debug Configurations - program arguments 配置内容-Xjre C:Program FilesJavajdk1.8.0_161jre java.lang.String代码示例https://github.com/fuzhengwei/itstack-demo-jvm/tree/master/itstack-demo-jvm-03itstack-demo-jvm-03├── pom.xml└── src └── main │ └── java │ └── org.itstack.demo.jvm │ ├── classfile │ │ ├── attributes {BootstrapMethods/Code/ConstantValue...} │ │ ├── constantpool {CONSTANT_TAG_CLASS/CONSTANT_TAG_FIELDREF/CONSTANT_TAG_METHODREF...} │ │ ├── ClassFile.java │ │ ├── ClassReader.java │ │ └── MemberInfo.java │ ├── classpath │ │ ├── impl │ │ │ ├── CompositeEntry.java │ │ │ ├── DirEntry.java │ │ │ ├── WildcardEntry.java │ │ │ └── ZipEntry.java │ │ ├── Classpath.java │ │ └── Entry.java │ ├── Cmd.java │ └── Main.java └── test └── java └── org.itstack.demo.test └── HelloWorld.java代码篇幅较长不一一列举AttributeInfo.javapackage org.itstack.demo.jvm.classfile.attributes;import org.itstack.demo.jvm.classfile.ClassReader;import org.itstack.demo.jvm.classfile.attributes.impl.*;import org.itstack.demo.jvm.classfile.constantpool.ConstantPool;/** * http://www.itstack.org * create by fuzhengwei on 2019/4/26 */public interface AttributeInfo { void readInfo(ClassReader reader); static AttributeInfo[] readAttributes(ClassReader reader, ConstantPool constantPool) { int attributesCount reader.readU2ToInt(); AttributeInfo[] attributes new AttributeInfo[attributesCount]; for (int i 0; i attributesCount; i) { attributes[i] readAttribute(reader, constantPool); } return attributes; } static AttributeInfo readAttribute(ClassReader reader, ConstantPool constantPool) { int attrNameIdx reader.readU2ToInt(); String attrName constantPool.getUTF8(attrNameIdx); int attrLen reader.readU4ToInt(); AttributeInfo attrInfo newAttributeInfo(attrName, attrLen, constantPool); attrInfo.readInfo(reader); return attrInfo; } static AttributeInfo newAttributeInfo(String attrName, int attrLen, ConstantPool constantPool) { switch (attrName) { case BootstrapMethods: return new BootstrapMethodsAttribute(); case Code: return new CodeAttribute(constantPool); case ConstantValue: return new ConstantValueAttribute(); case Deprecated: return new DeprecatedAttribute(); case EnclosingMethod: return new EnclosingMethodAttribute(constantPool); case Exceptions: return new ExceptionsAttribute(); case InnerClasses: return new InnerClassesAttribute(); case LineNumberTable: return new LineNumberTableAttribute(); case LocalVariableTable: return new LocalVariableTableAttribute(); case LocalVariableTypeTable: return new LocalVariableTypeTableAttribute(); // case MethodParameters: // case RuntimeInvisibleAnnotations: // case RuntimeInvisibleParameterAnnotations: // case RuntimeInvisibleTypeAnnotations: // case RuntimeVisibleAnnotations: // case RuntimeVisibleParameterAnnotations: // case RuntimeVisibleTypeAnnotations: case Signature: return new SignatureAttribute(constantPool); case SourceFile: return new SourceFileAttribute(constantPool); // case SourceDebugExtension: // case StackMapTable: case Synthetic: return new SyntheticAttribute(); default: return new UnparsedAttribute(attrName, attrLen); } }}ConstantInfo.javapackage org.itstack.demo.jvm.classfile.constantpool;import org.itstack.demo.jvm.classfile.ClassReader;import org.itstack.demo.jvm.classfile.constantpool.impl.*;/** * http://www.itstack.org * create by fuzhengwei on 2019/4/26 */public interface ConstantInfo { int CONSTANT_TAG_CLASS 7; int CONSTANT_TAG_FIELDREF 9; int CONSTANT_TAG_METHODREF 10; int CONSTANT_TAG_INTERFACEMETHODREF 11; int CONSTANT_TAG_STRING 8; int CONSTANT_TAG_INTEGER 3; int CONSTANT_TAG_FLOAT 4; int CONSTANT_TAG_LONG 5; int CONSTANT_TAG_DOUBLE 6; int CONSTANT_TAG_NAMEANDTYPE 12; int CONSTANT_TAG_UTF8 1; int CONSTANT_TAG_METHODHANDLE 15; int CONSTANT_TAG_METHODTYPE 16; int CONSTANT_TAG_INVOKEDYNAMIC 18; void readInfo(ClassReader reader); int tag(); static ConstantInfo readConstantInfo(ClassReader reader, ConstantPool constantPool) { int tag reader.readU1ToInt(); ConstantInfo constantInfo newConstantInfo(tag, constantPool); constantInfo.readInfo(reader); return constantInfo; } static ConstantInfo newConstantInfo(int tag, ConstantPool constantPool) { switch (tag) { case CONSTANT_TAG_INTEGER: return new ConstantIntegerInfo(); case CONSTANT_TAG_FLOAT: return new ConstantFloatInfo(); case CONSTANT_TAG_LONG: return new ConstantLongInfo(); case CONSTANT_TAG_DOUBLE: return new ConstantDoubleInfo(); case CONSTANT_TAG_UTF8: return new ConstantUtf8Info(); case CONSTANT_TAG_STRING: return new ConstantStringInfo(constantPool); case CONSTANT_TAG_CLASS: return new ConstantClassInfo(constantPool); case CONSTANT_TAG_FIELDREF: return new ConstantFieldRefInfo(constantPool); case CONSTANT_TAG_METHODREF: return new ConstantMethodRefInfo(constantPool); case CONSTANT_TAG_INTERFACEMETHODREF: return new ConstantInterfaceMethodRefInfo(constantPool); case CONSTANT_TAG_NAMEANDTYPE: return new ConstantNameAndTypeInfo(); case CONSTANT_TAG_METHODTYPE: return new ConstantMethodTypeInfo(); case CONSTANT_TAG_METHODHANDLE: return new ConstantMethodHandleInfo(); case CONSTANT_TAG_INVOKEDYNAMIC: return new ConstantInvokeDynamicInfo(); default: throw new ClassFormatError(constant pool tag); } }}ClassFile.javapackage org.itstack.demo.jvm.classfile;import org.itstack.demo.jvm.classfile.attributes.AttributeInfo;import org.itstack.demo.jvm.classfile.constantpool.ConstantPool;/** * http://www.itstack.org * create by fuzhengwei on 2019/4/26 */public class ClassFile { private int minorVersion; private int majorVersion; private ConstantPool constantPool; private int accessFlags; private int thisClassIdx; private int supperClassIdx; private int[] interfaces; private MemberInfo[] fields; private MemberInfo[] methods; private AttributeInfo[] attributes; public ClassFile(byte[] classData) { ClassReader reader new ClassReader(classData); this.readAndCheckMagic(reader); this.readAndCheckVersion(reader); this.constantPool this.readConstantPool(reader); this.accessFlags reader.readU2ToInt(); this.thisClassIdx reader.readU2ToInt(); this.supperClassIdx reader.readU2ToInt(); this.interfaces reader.readUInt16s(); this.fields MemberInfo.readMembers(reader, constantPool); this.methods MemberInfo.readMembers(reader, constantPool); this.attributes AttributeInfo.readAttributes(reader, constantPool); } private void readAndCheckMagic(ClassReader reader) { String magic reader.readU4ToHexStr(); if (!cafebabe.equals(magic)) { throw new ClassFormatError(magic!); } } private void readAndCheckVersion(ClassReader reader) { this.minorVersion reader.readU2ToInt(); this.majorVersion reader.readU2ToInt(); switch (this.majorVersion) { case 45: return; case 46: case 47: case 48: case 49: case 50: case 51: case 52: if (this.minorVersion 0) return; } throw new UnsupportedClassVersionError(); } private ConstantPool readConstantPool(ClassReader reader) { return new ConstantPool(reader); } public int minorVersion(){ return this.minorVersion; } public int majorVersion(){ return this.majorVersion; } public ConstantPool constantPool(){ return this.constantPool; } public int accessFlags() { return this.accessFlags; } public MemberInfo[] fields() { return this.fields; } public MemberInfo[] methods() { return this.methods; } public String className() { return this.constantPool.getClassName(this.thisClassIdx); } public String superClassName() { if (this.supperClassIdx 0) return ; return this.constantPool.getClassName(this.supperClassIdx); } public String[] interfaceNames() { String[] interfaceNames new String[this.interfaces.length]; for (int i 0; i this.interfaces.length; i) { interfaceNames[i] this.constantPool.getClassName(interfaces[i]); } return interfaceNames; }}ClassReader.javapackage org.itstack.demo.jvm.classfile;import java.math.BigInteger;/** * http://www.itstack.org * create by fuzhengwei on 2019/5/13 * * java虚拟机定义了u1、u2、u4三种数据类型来表示1字节、2字节、4字节无符号整数。 * 在如下实现中用增位方式表示无符号类型 * u1、u2可以用int类型存储因为int类型是4字节 * u4 需要用long类型存储因为long类型是8字节 */public class ClassReader { private byte[] data; public ClassReader(byte[] data) { this.data data; } //u1 public int readUint8() { byte[] val readByte(1); return byte2int(val); } //u2 public int readUint16() { byte[] val readByte(2); return byte2int(val); } //u4 public long readUint32() { byte[] val readByte(4); String str_hex new BigInteger(1, val).toString(16); return Long.parseLong(str_hex, 16); } public float readUint64TFloat() { byte[] val readByte(8); return new BigInteger(1, val).floatValue(); } public long readUint64TLong() { byte[] val readByte(8); return new BigInteger(1, val).longValue(); } public double readUint64TDouble() { byte[] val readByte(8); return new BigInteger(1, val).doubleValue(); } public int[] readUint16s() { int n this.readUint16(); int[] s new int[n]; for (int i 0; i n; i) { s[i] this.readUint16(); } return s; } public byte[] readBytes(int n) { return readByte(n); } private byte[] readByte(int length) { byte[] copy new byte[length]; System.arraycopy(data, 0, copy, 0, length); System.arraycopy(data, length, data, 0, data.length - length); return copy; } private int byte2int(byte[] val) { String str_hex new BigInteger(1, val).toString(16); return Integer.parseInt(str_hex, 16); }}MemberInfo.javapackage org.itstack.demo.jvm.classfile;import org.itstack.demo.jvm.classfile.attributes.AttributeInfo;import org.itstack.demo.jvm.classfile.attributes.impl.CodeAttribute;import org.itstack.demo.jvm.classfile.attributes.impl.ConstantValueAttribute;import org.itstack.demo.jvm.classfile.constantpool.ConstantPool;/** * http://www.itstack.org * create by fuzhengwei on 2019/4/26 */public class MemberInfo { private ConstantPool constantPool; private int accessFlags; private int nameIdx; private int descriptorIdx; private AttributeInfo[] attributes; public MemberInfo(ClassReader reader, ConstantPool constantPool) { this.constantPool constantPool; this.accessFlags reader.readU2ToInt(); this.nameIdx reader.readU2ToInt(); this.descriptorIdx reader.readU2ToInt(); this.attributes AttributeInfo.readAttributes(reader, constantPool); } public static MemberInfo[] readMembers(ClassReader reader, ConstantPool constantPool) { int fieldCount reader.readU2ToInt(); MemberInfo[] fields new MemberInfo[fieldCount]; for (int i 0; i fieldCount; i) { fields[i] new MemberInfo(reader, constantPool); } return fields; } public int accessFlags() { return this.accessFlags; } public String name() { return this.constantPool.getUTF8(this.nameIdx); } public String descriptor() { return this.constantPool.getUTF8(this.descriptorIdx); } public CodeAttribute codeAttribute() { for (AttributeInfo attrInfo : attributes) { if (attrInfo instanceof CodeAttribute) return (CodeAttribute) attrInfo; } return null; } public ConstantValueAttribute ConstantValueAttribute() { for (AttributeInfo attrInfo : attributes) { if (attrInfo instanceof ConstantValueAttribute) return (ConstantValueAttribute) attrInfo; } return null; }}Main.javapackage org.itstack.demo.jvm;import org.itstack.demo.jvm.classfile.ClassFile;import org.itstack.demo.jvm.classfile.MemberInfo;import org.itstack.demo.jvm.classpath.Classpath;import java.util.Arrays;/** * http://www.itstack.org * create by fuzhengwei on 2019/4/24 */public class Main { public static void main(String[] args) { Cmd cmd Cmd.parse(args); if (!cmd.ok || cmd.helpFlag) { System.out.println(Usage: [-options] class [args...]); return; } if (cmd.versionFlag) { //注意案例测试都是基于1.8另外jdk1.9以后使用模块化没有rt.jar System.out.println(java version 1.8.0); return; } startJVM(cmd); } private static void startJVM(Cmd cmd) { Classpath classpath new Classpath(cmd.jre, cmd.classpath); System.out.printf(classpath%s class%s args%s

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/924461.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

开设赌场罪建设网站有什么专业做心理的网站

据悉,从2023年11月1日开始,TikTok Shop将根据卖家的店铺表现来应用3种不同类型的结算期,其中,标准结算期:资金交收期为8个日历日;快速结算期:资金交收期为3个日历日;延长结算期&…

高端品牌网站建设建议网站制作价格范围

题干&#xff1a; 给出N个正整数&#xff0c;检测每个数是否为质数。如果是&#xff0c;输出"Yes"&#xff0c;否则输出"No"。 Input 第1行&#xff1a;一个数N&#xff0c;表示正整数的数量。(1 < N < 1000) 第2 - N 1行&#xff1a;每行1个数…

有网站加金币的做弊器吗长沙创求网络科技有限公司

《微机与单片机概述课件.ppt》由会员分享&#xff0c;提供在线免费全文阅读可下载&#xff0c;此文档格式为ppt&#xff0c;更多相关《微机与单片机概述课件.ppt》文档请在天天文库搜索。1、1.微机与单片机概述1.1 微型计算机的特点和发展1.2 微机的分类与单片机1.3 微处理器、…

001

001$(".postTitle2").removeClass("postTitle2").addClass("singleposttitle");001.在hello world中编译器工具链分别做了什么为便于理解底层原理,本文中所有操作均在cmd中使用gcc实现…

US$188 Tubular Key Clamps for SEC-E9 Key Cutting Machine Tubular Key Cutting

Tubular Key Clamps Work on House keys Motorcycle keys for SEC-E9 Key Cutting MachineIntroduction of Jaw:This Car Key Clamp is mainly composed by the front-block, post-block, clamp base, handle, elastic…

做网站Linuxseo排名优化公司哪家好

[css] css中的url()要不要加引号&#xff1f;说说你的理解 可以加&#xff0c;也可以不加。这个跟html标签的属性书写可以加引号也可以不加引号是一样的道理&#xff0c;当然如果属性中含有特殊字符比如空格则需要加空格&#xff0c;否则会引起浏览器解析错误。如果想养成良好…

网站建设客户怎么找网站推广策划书 精品

市政公共设施建设在近几年来发展迅速&#xff0c;市政设备的更新换代&#xff0c;资产管理等也成为其中的重要一项。在市政设施建设过程中&#xff0c;井盖也是不可忽视的&#xff0c;一方面&#xff0c;根据传统的管理井盖模式来讲&#xff0c;缺乏有效的远程监控管理方法和手…

营销型网站建设论坛wordpress 按时间显示文章

工程目录图 请点击下面工程名称&#xff0c;跳转到代码的仓库页面&#xff0c;将工程 下载下来 Demo Code 里有详细的注释 01okhttp module里 包含的设计模式&#xff1a;建造者设计模式、责任链设计模式 CustomInject 演示自定义注解 代码&#xff1a;okhttp原理分析、Andro…

视频网站开发需要什么插件网站开发和推广的不同

前言消息堆积是消息中间件的一大特色&#xff0c;消息中间件的流量削峰、冗余存储等功能正是得益于消息中间件的消息堆积能力。然而消息堆积其实是一把亦正亦邪的双刃剑&#xff0c;如果应用场合不恰当反而会对上下游的业务造成不必要的麻烦&#xff0c;比如消息堆积势必会影响…

test7

tewagawegawegawegawegawegawenigawoengiawngiawnegpiawnegiawpgoewigwegaw6e15g6w51eg56aweg65aw56eg1w

单页面网站 万网x3建什么网站容易挣钱

MySQL数据库中&#xff0c;建立合适的索引对于提高查询性能至关重要。然而&#xff0c;在某些情况下&#xff0c;我们可能需要进一步优化查询性能&#xff0c;而覆盖索引&#xff08;Covering Index&#xff09;就是一种有效的方法。本文将介绍什么是覆盖索引以及如何在MySQL中…

US$49 Hot Sale 0386 FGTech Galletto 4 Master V54 BDM-OBD Function Unlock Version

0386 FGTech Galletto 4 Master V54 BDM-OBD Function Unlock VersionTop 6 Reasons To Get FGTech Galletto 41. Latest Version: 2014 V54 2. Supported Operating System: windows XP. more friendly than Fgtech …

影视视频网站怎么做seo公司

本人技术笨拙&#xff0c;今天在发布DIPS的MVC4.0项目&#xff0c;并部署到IIS上&#xff0c;遇到各种问题。在查询相关资料后&#xff0c;最终得以解决&#xff0c;所以想把这个过程记录下来。 注&#xff1a;DIPS为一种非关系型数据库 首先&#xff0c;需要安装和注册DIPS。注…

亚马逊注册没有公司网站怎么做怎么利用公网做网站

1、mqnamesrv.exe启动成功 2、启动mqbroker.exe失败 解决办法&#xff0c;删除C:\Users\"当前系统用户名"\store下的所有文件&#xff0c;就可以了转载于:https://www.cnblogs.com/roujingchuxia/p/7685796.html

vscode github 推送失败

问 AI 后的解决方法记录 问题根因:你的本地 DNS 服务器(192.168.1.1,一般是路由器或运营商 DNS)错误地把 github.com 解析成了回环地址 127.0.0.1,导致 Git 无法连上真正的 GitHub。 通过在终端运行(base) PS C:\…

信奥大联赛周赛(提高组)#2515-S 赛后盘点

战果 黄绿蓝紫,248 pts,rk 4,T3 双指针维护反了qwq,原因两个:样例太水,只给 3h。赛后略改过 T3,气死了,样例为啥这么水? D1505 E-小梦的学术论文 简单二分答案0.0,非常板,没啥好讲的。秒了。核心代码 int c…

wordpress卡蜜巩义网站优化技巧

作者主页&#xff1a;易学蔚来-技术互助文末获取源码 简介&#xff1a;Java领域优质创作者 Java项目、简历模板、学习资料、面试题库 教师考勤管理系统是基于JavaVueSpringBootMySQL实现的&#xff0c;包含了管理员、学生、教师三类用户。该系统实现了班级管理、课程安排、考勤…

南昌网站建设冲浪者4435建站

程序是基于Matlab2016a&#xff0c;工具箱版本为Robotic Toolbox 10.2 参考博客&#xff1a; MATLAB机器人工具箱使用 Matlab Robotic Toolbox V9.10工具箱(三)&#xff1a;轨迹规划 六轴机器人建模方法、正逆解、轨迹规划实例与Matalb Robotic Toolbox 的实现 效果&#xff1a…

贵阳市住房建设局网站做网站用什么虚拟服务器

目录 1 前言2 本地代码上传2.1 命令行方法2.2 图形界面法2.3 结果 1 前言 GitHub是一个面向开源及私有软件项目的托管平台&#xff0c;因为只支持Git作为唯一的版本库格式进行托管&#xff0c;故名GitHub 。开发者常常将github作为代码管理平台&#xff0c;方便代码存储、版本…

虚拟机仅主机模式下使用ssh远程连接Linux(EHEL8)连接慢,需要等待30秒以上

大概原因:仅主机模式中,虚拟机与物理机处于同一局域网内,但DNS服务可能未正确配置,当SSH请求域名解析时,服务器会等待DNS响应,导致连接延迟; 部分Linux系统默认开启GSSAPI认证,该认证机制在域名解析失败时会显…