Tabnine Logo
ClassWriter.toByteArray
Code IndexAdd Tabnine to your IDE (free)

How to use
toByteArray
method
in
jersey.repackaged.org.objectweb.asm.ClassWriter

Best Java code snippets using jersey.repackaged.org.objectweb.asm.ClassWriter.toByteArray (Showing top 10 results out of 315)

origin: com.sun.jersey/jersey-server

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: com.sun.jersey/jersey-servlet

  Class<?> createBeanClass() {
    ClassWriter writer = new ClassWriter(0);
    String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1));
    writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null);
    MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
    methodVisitor.visitCode();
    methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
    methodVisitor.visitInsn(Opcodes.RETURN);
    methodVisitor.visitMaxs(1, 1);
    methodVisitor.visitEnd();
    writer.visitEnd();
    byte[] bytecode = writer.toByteArray();
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    try {
      Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0,
          bytecode.length);
      LOGGER.fine("Created class " + result.getName());
      return result;
    } catch (Throwable t) {
      LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t);
      return null;
    }
  }
}
origin: com.sun.jersey/jersey-bundle

  Class<?> createBeanClass() {
    ClassWriter writer = new ClassWriter(0);
    String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1));
    writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null);
    MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
    methodVisitor.visitCode();
    methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
    methodVisitor.visitInsn(Opcodes.RETURN);
    methodVisitor.visitMaxs(1, 1);
    methodVisitor.visitEnd();
    writer.visitEnd();
    byte[] bytecode = writer.toByteArray();
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    try {
      Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0,
          bytecode.length);
      LOGGER.fine("Created class " + result.getName());
      return result;
    } catch (Throwable t) {
      LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t);
      return null;
    }
  }
}
origin: jersey/jersey-1.x

  Class<?> createBeanClass() {
    ClassWriter writer = new ClassWriter(0);
    String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1));
    writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null);
    MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
    methodVisitor.visitCode();
    methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
    methodVisitor.visitInsn(Opcodes.RETURN);
    methodVisitor.visitMaxs(1, 1);
    methodVisitor.visitEnd();
    writer.visitEnd();
    byte[] bytecode = writer.toByteArray();
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    try {
      Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0,
          bytecode.length);
      LOGGER.fine("Created class " + result.getName());
      return result;
    } catch (Throwable t) {
      LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t);
      return null;
    }
  }
}
origin: org.glassfish.jersey.core/jersey-server

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: com.sun.jersey/jersey-bundle

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: eclipse-ee4j/jersey

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: org.glassfish.jersey.bundles/jaxrs-ri

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: eclipse-ee4j/jersey

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
origin: jersey/jersey-1.x

invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
jersey.repackaged.org.objectweb.asmClassWritertoByteArray

Javadoc

Returns the bytecode of the class that was build with this class writer.

Popular methods of ClassWriter

  • addType
    Adds the given Item to #typeTable.
  • addUninitializedType
    Adds the given "uninitialized" type to #typeTable and returns its index. This method is used for UNI
  • get
    Returns the constant pool's hash table item which is equal to the given item.
  • getCommonSuperClass
    Returns the common super type of the two given types. The default implementation of this method load
  • getMergedType
    Returns the index of the common super type of the two given types. This method calls #getCommonSuper
  • newClass
    Adds a class reference to the constant pool of the class being build. Does nothing if the constant p
  • newClassItem
    Adds a class reference to the constant pool of the class being build. Does nothing if the constant p
  • newConst
    Adds a number or string constant to the constant pool of the class being build. Does nothing if the
  • newConstItem
    Adds a number or string constant to the constant pool of the class being build. Does nothing if the
  • newDouble
    Adds a double to the constant pool of the class being build. Does nothing if the constant pool alrea
  • newField
    Adds a field reference to the constant pool of the class being build. Does nothing if the constant p
  • newFieldItem
    Adds a field reference to the constant pool of the class being build. Does nothing if the constant p
  • newField,
  • newFieldItem,
  • newFloat,
  • newHandle,
  • newHandleItem,
  • newInteger,
  • newInvokeDynamicItem,
  • newLong,
  • newMethod

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best plugins for Eclipse
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