Java Code Examples for jdk.internal.org.objectweb.asm.ClassReader#readUnsignedShort()
The following examples show how to use
jdk.internal.org.objectweb.asm.ClassReader#readUnsignedShort() .
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: ClassFileAttributes.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) { // package count int package_count = cr.readUnsignedShort(off); off += 2; // packages Set<String> packages = new HashSet<>(); for (int i=0; i<package_count; i++) { String pkg = cr.readPackage(off, buf).replace('/', '.'); packages.add(pkg); off += 2; } return new ModulePackagesAttribute(packages); }
Example 2
Source File: ClassFileAttributes.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) { String targetPlatform = null; int target_platform_index = cr.readUnsignedShort(off); if (target_platform_index != 0) targetPlatform = cr.readUTF8(off, buf); off += 2; return new ModuleTargetAttribute(targetPlatform); }
Example 3
Source File: ModuleResolutionAttribute.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override protected Attribute read( final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeOffset, final Label[] labels) { return new ModuleResolutionAttribute(classReader.readUnsignedShort(offset)); }
Example 4
Source File: ModuleHashesAttribute.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override protected Attribute read( final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeAttributeOffset, final Label[] labels) { int currentOffset = offset; String hashAlgorithm = classReader.readUTF8(currentOffset, charBuffer); currentOffset += 2; int numModules = classReader.readUnsignedShort(currentOffset); currentOffset += 2; ArrayList<String> moduleList = new ArrayList<String>(numModules); ArrayList<byte[]> hashList = new ArrayList<byte[]>(numModules); for (int i = 0; i < numModules; ++i) { String module = classReader.readModule(currentOffset, charBuffer); currentOffset += 2; moduleList.add(module); int hashLength = classReader.readUnsignedShort(currentOffset); currentOffset += 2; byte[] hash = new byte[hashLength]; for (int j = 0; j < hashLength; ++j) { hash[j] = (byte) (classReader.readByte(currentOffset) & 0xFF); currentOffset += 1; } hashList.add(hash); } return new ModuleHashesAttribute(hashAlgorithm, moduleList, hashList); }
Example 5
Source File: ClassFileAttributes.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) { String algorithm = cr.readUTF8(off, buf); off += 2; int hashes_count = cr.readUnsignedShort(off); off += 2; Map<String, byte[]> map = new HashMap<>(); for (int i=0; i<hashes_count; i++) { String mn = cr.readModule(off, buf); off += 2; int hash_length = cr.readUnsignedShort(off); off += 2; byte[] hash = new byte[hash_length]; for (int j=0; j<hash_length; j++) { hash[j] = (byte) (0xff & cr.readByte(off+j)); } off += hash_length; map.put(mn, hash); } ModuleHashes hashes = new ModuleHashes(algorithm, map); return new ModuleHashesAttribute(hashes); }
Example 6
Source File: ClassFileAttributes.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) { int flags = cr.readUnsignedShort(off); return new ModuleResolutionAttribute(flags); }