org.objectweb.asm.ByteVector Java Examples

The following examples show how to use org.objectweb.asm.ByteVector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModuleHashesAttribute.java    From Concurnas with MIT License 6 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(classWriter.newUTF8(algorithm));
  if (modules == null) {
    byteVector.putShort(0);
  } else {
    int numModules = modules.size();
    byteVector.putShort(numModules);
    for (int i = 0; i < numModules; ++i) {
      String module = modules.get(i);
      byte[] hash = hashes.get(i);
      byteVector
          .putShort(classWriter.newModule(module))
          .putShort(hash.length)
          .putByteArray(hash, 0, hash.length);
    }
  }
  return byteVector;
}
 
Example #2
Source File: ModuleHashesAttribute.java    From JByteMod-Beta with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(classWriter.newUTF8(algorithm));
  if (modules == null) {
    byteVector.putShort(0);
  } else {
    int numModules = modules.size();
    byteVector.putShort(numModules);
    for (int i = 0; i < numModules; ++i) {
      String module = modules.get(i);
      byte[] hash = hashes.get(i);
      byteVector
          .putShort(classWriter.newModule(module))
          .putShort(hash.length)
          .putByteArray(hash, 0, hash.length);
    }
  }
  return byteVector;
}
 
Example #3
Source File: ASMBackendUtils.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create an ASM attribute from an Soot attribute
 * @param attr Soot attribute
 * @return ASM attribute
 */
public static org.objectweb.asm.Attribute createASMAttribute(Attribute attr) {
    final Attribute a = attr;
    return new org.objectweb.asm.Attribute(
            attr.getName()) {
        @Override
        protected ByteVector write(final ClassWriter cw,
                                   final byte[] code, final int len,
                                   final int maxStack, final int maxLocals) {
            ByteVector result = new ByteVector();
            result.putByteArray(a.getValue(), 0,
                    a.getValue().length);
            return result;
        }
    };
}
 
Example #4
Source File: ModuleHashesAttribute.java    From JReFrameworker with MIT License 6 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(classWriter.newUTF8(algorithm));
  if (modules == null) {
    byteVector.putShort(0);
  } else {
    int numModules = modules.size();
    byteVector.putShort(numModules);
    for (int i = 0; i < numModules; ++i) {
      String module = modules.get(i);
      byte[] hash = hashes.get(i);
      byteVector
          .putShort(classWriter.newModule(module))
          .putShort(hash.length)
          .putByteArray(hash, 0, hash.length);
    }
  }
  return byteVector;
}
 
Example #5
Source File: ModuleHashesAttribute.java    From JReFrameworker with MIT License 6 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(classWriter.newUTF8(algorithm));
  if (modules == null) {
    byteVector.putShort(0);
  } else {
    int numModules = modules.size();
    byteVector.putShort(numModules);
    for (int i = 0; i < numModules; ++i) {
      String module = modules.get(i);
      byte[] hash = hashes.get(i);
      byteVector
          .putShort(classWriter.newModule(module))
          .putShort(hash.length)
          .putByteArray(hash, 0, hash.length);
    }
  }
  return byteVector;
}
 
Example #6
Source File: ModuleResolutionAttribute.java    From Concurnas with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(resolution);
  return byteVector;
}
 
Example #7
Source File: ModuleTargetAttribute.java    From Concurnas with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(platform == null ? 0 : classWriter.newUTF8(platform));
  return byteVector;
}
 
Example #8
Source File: ModuleResolutionAttribute.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(resolution);
  return byteVector;
}
 
Example #9
Source File: ModuleTargetAttribute.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(platform == null ? 0 : classWriter.newUTF8(platform));
  return byteVector;
}
 
Example #10
Source File: ModuleResolutionAttribute.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(resolution);
  return byteVector;
}
 
Example #11
Source File: ModuleTargetAttribute.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(platform == null ? 0 : classWriter.newUTF8(platform));
  return byteVector;
}
 
Example #12
Source File: ModuleResolutionAttribute.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(resolution);
  return byteVector;
}
 
Example #13
Source File: ModuleTargetAttribute.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
protected ByteVector write(
    final ClassWriter classWriter,
    final byte[] code,
    final int codeLength,
    final int maxStack,
    final int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byteVector.putShort(platform == null ? 0 : classWriter.newUTF8(platform));
  return byteVector;
}
 
Example #14
Source File: RetroWeaverAttribute.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected ByteVector write(
    final ClassWriter cw,
    final byte[] code,
    final int len,
    final int maxStack,
    final int maxLocals)
{
	ByteVector bv = new ByteVector();

    bv.putInt(retroweaverBuildNumber);
    bv.putInt(originalClassVersion);
    bv.putLong(timestamp);

    return bv;
}
 
Example #15
Source File: DesugarMethodAttribute.java    From bazel with Apache License 2.0 5 votes vote down vote up
@Override
protected ByteVector write(
    ClassWriter classWriter, byte[] code, int codeLength, int maxStack, int maxLocals) {
  ByteVector byteVector = new ByteVector();
  byte[] payloadBytes = payload.toByteArray();
  byteVector.putByteArray(payloadBytes, 0, payloadBytes.length);
  return byteVector;
}
 
Example #16
Source File: TestClassAdapter.java    From HotswapAgent with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ByteVector write(ClassWriter writer, byte[] code, int len,
        int maxStack, int maxLocals) {
    return new ByteVector().putByte(value);
}