You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnwovenClassFileWithThirdPartyManagedBytecode.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.weaver.bcel;
  12. /**
  13. * @author colyer This subclass of UnwovenClassFile allows a third-party to manage the actual bytes that comprise the class. This
  14. * means the third party can return a reference to an existing array, or create the bytes on demand, or apply any other
  15. * strategy that makes sense. By refering to bytes held elsewhere, the goal is to reduce the overall memory consumption by
  16. * not holding a copy.
  17. */
  18. public class UnwovenClassFileWithThirdPartyManagedBytecode extends UnwovenClassFile {
  19. IByteCodeProvider provider;
  20. public interface IByteCodeProvider {
  21. byte[] getBytes();
  22. }
  23. // OPTIMIZE make classname an input char[]
  24. public UnwovenClassFileWithThirdPartyManagedBytecode(String filename, String classname, IByteCodeProvider provider) {
  25. super(filename, classname, null);
  26. this.provider = provider;
  27. }
  28. public byte[] getBytes() {
  29. return provider.getBytes();
  30. }
  31. }