All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yworks.yguard.obf.classfile.ModulePackagesAttrInfo Maven / Gradle / Ivy

Go to download

The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts

There is a newer version: 2.10.0
Show newest version
package com.yworks.yguard.obf.classfile;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * Representation of a module packages attribute.
 * @author Thomas Behr
 */
public class ModulePackagesAttrInfo extends AttrInfo {
  // Constants -------------------------------------------------------------


  // Fields ----------------------------------------------------------------
  private int[] u2packageIndex;


  // Class Methods ---------------------------------------------------------


  // Instance Methods ------------------------------------------------------
  ModulePackagesAttrInfo(
          final ClassFile cf, final int attrNameIndex, final int attrLength
  ) {
    super(cf, attrNameIndex, attrLength);
  }

  /**
   * Returns "ModulePackages".
   */
  protected String getAttrName() {
    return ATTR_ModulePackages;
  }

  /**
   * Read the data following the header.
   */
  protected void readInfo( final DataInput din ) throws IOException {
    final int u2packageCount = din.readUnsignedShort();
    u2packageIndex = new int[u2packageCount];
    for (int i = 0; i < u2packageCount; ++i) {
      u2packageIndex[i] = din.readUnsignedShort();
    }
  }

  /**
   * Export data following the header to a DataOutput stream.
   */
  public void writeInfo( final DataOutput dout ) throws IOException {
    final int u2packageCount = u2packageIndex.length;
    dout.writeShort(u2packageCount);
    for (int i = 0; i < u2packageCount; ++i) {
      dout.writeShort(u2packageIndex[i]);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy