001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.bcel.classfile;
020
021import java.io.DataInput;
022import java.io.DataOutputStream;
023import java.io.IOException;
024
025import org.apache.bcel.Const;
026
027/**
028 * An annotation that is represented in the class file and is provided to the JVM.
029 *
030 * @since 6.0
031 */
032public class RuntimeVisibleAnnotations extends Annotations {
033
034    /**
035     * Constructs a new instance.
036     *
037     * @param nameIndex Index pointing to the name <em>Code</em>
038     * @param length Content length in bytes
039     * @param input Input stream
040     * @param constantPool Array of constants
041     * @throws IOException Thrown when an I/O exception of some sort has occurred.
042     */
043    public RuntimeVisibleAnnotations(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException {
044        super(Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS, nameIndex, length, input, constantPool, true);
045    }
046
047    /**
048     * Creates a deep copy of this attribute.
049     *
050     * @return deep copy of this attribute.
051     */
052    @Override
053    public Attribute copy(final ConstantPool constantPool) {
054        return (Attribute) clone();
055    }
056
057    @Override
058    public final void dump(final DataOutputStream dos) throws IOException {
059        super.dump(dos);
060        writeAnnotations(dos);
061    }
062}