Tabnine Logo
Constant
Code IndexAdd Tabnine to your IDE (free)

How to use
Constant
in
org.apache.bcel.classfile

Best Java code snippets using org.apache.bcel.classfile.Constant (Showing top 20 results out of 315)

origin: oracle/opengrok

String str;
int i, j, k;
byte tag = c.getTag();
origin: spotbugs/spotbugs

@Override
public void visitConstantPool(ConstantPool obj) {
  super.visitConstantPool(obj);
  Constant[] constant_pool = obj.getConstantPool();
  for (int i = 1; i < constant_pool.length; i++) {
    constant_pool[i].accept(this);
    byte tag = constant_pool[i].getTag();
    if ((tag == Const.CONSTANT_Double) || (tag == Const.CONSTANT_Long)) {
      i++;
    }
  }
}
origin: bcel/bcel

/**
 * Read constants from given file stream.
 *
 * @param file Input stream
 * @throws IOException
 * @throws ClassFormatException
 */
ConstantPool(DataInputStream file) throws IOException, ClassFormatException
{
 byte tag;
 constant_pool_count = file.readUnsignedShort();
 constant_pool       = new Constant[constant_pool_count];
 /* constant_pool[0] is unused by the compiler and may be used freely
  * by the implementation.
  */
 for(int i=1; i < constant_pool_count; i++) {
  constant_pool[i] = Constant.readConstant(file);
  
  /* Quote from the JVM specification:
   * "All eight byte constants take up two spots in the constant pool.
   * If this is the n'th byte in the constant pool, then the next item
   * will be numbered n+2"
   * 
   * Thus we have to increment the index counter.
   */
  tag = constant_pool[i].getTag();
  if((tag == Constants.CONSTANT_Double) || (tag == Constants.CONSTANT_Long))
 i++;
 }
}
origin: bcel/bcel

public void visitConstantPool(ConstantPool cp) {
 stack.push(cp);
 cp.accept(visitor);
 Constant[] constants = cp.getConstantPool();
 for(int i=1; i < constants.length; i++) {
  if(constants[i] != null)
 constants[i].accept(this);
 }
 stack.pop();
}
origin: org.apache.bcel/bcel

  /**
   * @return String representation
   */
  @Override
  public final String toString() {
    return super.toString() + "(name_index = " + name_index + ", signature_index = "
        + signature_index + ")";
  }
}
origin: bcel/bcel

/** 
 * Dump constant pool to file stream in binary format.
 *
 * @param file Output file stream
 * @throws IOException
 */
public void dump(DataOutputStream file) throws IOException
{
 file.writeShort(constant_pool_count);
 for(int i=1; i < constant_pool_count; i++)
  if(constant_pool[i] != null)
 constant_pool[i].dump(file);
}
origin: bcel/bcel

 /**
  * @return deep copy of this constant pool
  */
 public ConstantPool copy() {
  ConstantPool c = null;

  try {
   c = (ConstantPool)clone();
  } catch(CloneNotSupportedException e) {}

  c.constant_pool = new Constant[constant_pool_count];

  for(int i=1; i < constant_pool_count; i++) {
   if(constant_pool[i] != null)
  c.constant_pool[i] = constant_pool[i].copy();
  }

  return c;
 }
}
origin: org.apache.bcel/bcel

/**
 * Read constants from given input stream.
 *
 * @param input Input stream
 * @throws IOException
 * @throws ClassFormatException
 */
public ConstantPool(final DataInput input) throws IOException, ClassFormatException {
  byte tag;
  final int constant_pool_count = input.readUnsignedShort();
  constant_pool = new Constant[constant_pool_count];
  /* constant_pool[0] is unused by the compiler and may be used freely
   * by the implementation.
   */
  for (int i = 1; i < constant_pool_count; i++) {
    constant_pool[i] = Constant.readConstant(input);
    /* Quote from the JVM specification:
     * "All eight byte constants take up two spots in the constant pool.
     * If this is the n'th byte in the constant pool, then the next item
     * will be numbered n+2"
     *
     * Thus we have to increment the index counter.
     */
    tag = constant_pool[i].getTag();
    if ((tag == Const.CONSTANT_Double) || (tag == Const.CONSTANT_Long)) {
      i++;
    }
  }
}
origin: org.apache.bcel/bcel

@Override
public void visitConstantPool(final ConstantPool cp)
{
  stack.push(cp);
  cp.accept(visitor);
  final Constant[] constants = cp.getConstantPool();
  for (int i = 1; i < constants.length; i++)
  {
    if (constants[i] != null)
    {
      constants[i].accept(this);
    }
  }
  stack.pop();
}
origin: org.apache.bcel/bcel

  /**
   * @return String representation.
   */
  @Override
  public final String toString() {
    return super.toString() + "(name_index = " + name_index + ")";
  }
}
origin: org.apache.bcel/bcel

/**
 * Dump constant pool to file stream in binary format.
 *
 * @param file Output file stream
 * @throws IOException
 */
public void dump( final DataOutputStream file ) throws IOException {
  file.writeShort(constant_pool.length);
  for (int i = 1; i < constant_pool.length; i++) {
    if (constant_pool[i] != null) {
      constant_pool[i].dump(file);
    }
  }
}
origin: org.apache.bcel/bcel

  /**
   * @return deep copy of this constant pool
   */
  public ConstantPool copy() {
    ConstantPool c = null;
    try {
      c = (ConstantPool) clone();
      c.constant_pool = new Constant[constant_pool.length];
      for (int i = 1; i < constant_pool.length; i++) {
        if (constant_pool[i] != null) {
          c.constant_pool[i] = constant_pool[i].copy();
        }
      }
    } catch (final CloneNotSupportedException e) {
      // TODO should this throw?
    }
    return c;
  }
}
origin: org.apache.bcel/bcel

/**
 * Dump constant package to file stream in binary format.
 *
 * @param file Output file stream
 * @throws IOException
 */
@Override
public final void dump( final DataOutputStream file ) throws IOException {
  file.writeByte(super.getTag());
  file.writeShort(name_index);
}
origin: com.google.code.findbugs/findbugs

@Override
public void visitConstantPool(ConstantPool obj) {
  super.visitConstantPool(obj);
  Constant[] constant_pool = obj.getConstantPool();
  for (int i = 1; i < constant_pool.length; i++) {
    constant_pool[i].accept(this);
    byte tag = constant_pool[i].getTag();
    if ((tag == CONSTANT_Double) || (tag == CONSTANT_Long)) {
      i++;
    }
  }
}
origin: org.jboss.windup.rules.apps/rules-java

c.accept(new EmptyVisitor()
origin: bcel/bcel

/**
 * @return String representation.
 */
public final String toString() {
 return super.toString() + "(bytes = " + bytes + ")";
}    
origin: org.apache.bcel/bcel

/**
 * Dump String in Utf8 format to file stream.
 *
 * @param file Output file stream
 * @throws IOException
 */
@Override
public final void dump( final DataOutputStream file ) throws IOException {
  file.writeByte(super.getTag());
  file.writeUTF(bytes);
}
origin: org.jboss.windup.rules/rules-impl

@Override
public void visitJavaClass(JavaClass obj)
{
  current = javaClassDao.getJavaClass(obj.getClassName());
  int major = obj.getMajor();
  int minor = obj.getMinor();
  current.setMajorVersion(major);
  current.setMinorVersion(minor);
  current.addResource(resource);
  current.setPackageName(obj.getPackageName());
  for (String interfaceName : obj.getInterfaceNames())
  {
    org.jboss.windup.graph.model.resource.JavaClass interfaceClass = javaClassDao.getJavaClass(interfaceName);
    // then we make the connection.
    current.addImplements(interfaceClass);
  }
  // process the pool.
  Constant[] pool = obj.getConstantPool().getConstantPool();
  for (Constant c : pool)
  {
    if (c == null)
      continue;
    c.accept(this);
  }
  String superClz = obj.getSuperclassName();
  org.jboss.windup.graph.model.resource.JavaClass superJavaClass = javaClassDao.getJavaClass(superClz);
  current.setExtends(superJavaClass);
}
origin: org.apache.bcel/bcel

  /**
   * @return String representation.
   *
   * not final as ConstantInvokeDynamic needs to modify
   */
  @Override
  public String toString() {
    return super.toString() + "(class_index = " + class_index + ", name_and_type_index = "
        + name_and_type_index + ")";
  }
}
origin: org.apache.bcel/bcel

/**
 * Dump constant field reference to file stream in binary format.
 *
 * @param file Output file stream
 * @throws IOException
 */
@Override
public final void dump( final DataOutputStream file ) throws IOException {
  file.writeByte(super.getTag());
  file.writeShort(string_index);
}
org.apache.bcel.classfileConstant

Javadoc

Abstract superclass for classes to represent the different constant types in the constant pool of a class file. The classes keep closely to the JVM specification.

Most used methods

  • getTag
  • accept
    Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a
  • copy
  • dump
  • readConstant
    Read one constant from the given file, the type depends on a tag byte.
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now