Puts the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter in the given ByteVector. @param output where the attributes must be put.
(final ByteVector output)
| 217 | * @param output where the attributes must be put. |
| 218 | */ |
| 219 | void putAttributes(final ByteVector output) { |
| 220 | // 6 bytes for name, flags and version, and 5 * 2 bytes for counts. |
| 221 | int moduleAttributeLength = |
| 222 | 16 + requires.length + exports.length + opens.length + usesIndex.length + provides.length; |
| 223 | output |
| 224 | .putShort(symbolTable.addConstantUtf8(Constants.MODULE)) |
| 225 | .putInt(moduleAttributeLength) |
| 226 | .putShort(moduleNameIndex) |
| 227 | .putShort(moduleFlags) |
| 228 | .putShort(moduleVersionIndex) |
| 229 | .putShort(requiresCount) |
| 230 | .putByteArray(requires.data, 0, requires.length) |
| 231 | .putShort(exportsCount) |
| 232 | .putByteArray(exports.data, 0, exports.length) |
| 233 | .putShort(opensCount) |
| 234 | .putByteArray(opens.data, 0, opens.length) |
| 235 | .putShort(usesCount) |
| 236 | .putByteArray(usesIndex.data, 0, usesIndex.length) |
| 237 | .putShort(providesCount) |
| 238 | .putByteArray(provides.data, 0, provides.length); |
| 239 | if (packageCount > 0) { |
| 240 | output |
| 241 | .putShort(symbolTable.addConstantUtf8(Constants.MODULE_PACKAGES)) |
| 242 | .putInt(2 + packageIndex.length) |
| 243 | .putShort(packageCount) |
| 244 | .putByteArray(packageIndex.data, 0, packageIndex.length); |
| 245 | } |
| 246 | if (mainClassIndex > 0) { |
| 247 | output |
| 248 | .putShort(symbolTable.addConstantUtf8(Constants.MODULE_MAIN_CLASS)) |
| 249 | .putInt(2) |
| 250 | .putShort(mainClassIndex); |
| 251 | } |
| 252 | } |
| 253 | } |
nothing calls this directly
no test coverage detected