You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

java-class-tools

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

java-class-tools

Read and write java class files in node or browser.

1.1.2
Source
npm
Version published
Weekly downloads
620
55%
Maintainers
1
Weekly downloads
 
Created
Source

java-class-tools

Build status

Examples:

Print all methods names

'use strict';

const { JavaClassFileReader } = require('java-class-tools');

const reader = new JavaClassFileReader();
const classFile = reader.read('path/to/file.class');

classFile.methods.forEach(md => {
  /**
   * Method name in constant-pool.
   * 
   * https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.7
   */
  const nameCpEntry = classFile.constant_pool[md.name_index];

  // To utf-8 string
  const name = String.fromCharCode.apply(null, nameCpEntry.bytes);

  console.log(name);
});

Keywords

java

FAQs

Package last updated on 15 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts