111 * @spec JPMS
112 */
113 protected SecureClassLoader(String name, ClassLoader parent) {
114 super(name, parent);
115 }
116
117 /**
118 * Converts an array of bytes into an instance of class Class,
119 * with an optional CodeSource. Before the
120 * class can be used it must be resolved.
121 * <p>
122 * If a non-null CodeSource is supplied a ProtectionDomain is
123 * constructed and associated with the class being defined.
124 *
125 * @param name the expected name of the class, or {@code null}
126 * if not known, using '.' and not '/' as the separator
127 * and without a trailing ".class" suffix.
128 * @param b the bytes that make up the class data. The bytes in
129 * positions {@code off} through {@code off+len-1}
130 * should have the format of a valid class file as defined by
131 * <cite>The Java™ Virtual Machine Specification</cite>.
132 * @param off the start offset in {@code b} of the class data
133 * @param len the length of the class data
134 * @param cs the associated CodeSource, or {@code null} if none
135 * @return the {@code Class} object created from the data,
136 * and optional CodeSource.
137 * @throws ClassFormatError if the data did not contain a valid class
138 * @throws IndexOutOfBoundsException if either {@code off} or
139 * {@code len} is negative, or if
140 * {@code off+len} is greater than {@code b.length}.
141 *
142 * @throws SecurityException if an attempt is made to add this class
143 * to a package that contains classes that were signed by
144 * a different set of certificates than this class, or if
145 * the class name begins with "java.".
146 */
147 protected final Class<?> defineClass(String name,
148 byte[] b, int off, int len,
149 CodeSource cs)
150 {
151 return defineClass(name, b, off, len, getProtectionDomain(cs));
152 }
153
154 /**
155 * Converts a {@link java.nio.ByteBuffer ByteBuffer}
156 * into an instance of class {@code Class}, with an optional CodeSource.
157 * Before the class can be used it must be resolved.
158 * <p>
159 * If a non-null CodeSource is supplied a ProtectionDomain is
160 * constructed and associated with the class being defined.
161 *
162 * @param name the expected name of the class, or {@code null}
163 * if not known, using '.' and not '/' as the separator
164 * and without a trailing ".class" suffix.
165 * @param b the bytes that make up the class data. The bytes from positions
166 * {@code b.position()} through {@code b.position() + b.limit() -1}
167 * should have the format of a valid class file as defined by
168 * <cite>The Java™ Virtual Machine Specification</cite>.
169 * @param cs the associated CodeSource, or {@code null} if none
170 * @return the {@code Class} object created from the data,
171 * and optional CodeSource.
172 * @throws ClassFormatError if the data did not contain a valid class
173 * @throws SecurityException if an attempt is made to add this class
174 * to a package that contains classes that were signed by
175 * a different set of certificates than this class, or if
176 * the class name begins with "java.".
177 *
178 * @since 1.5
179 */
180 protected final Class<?> defineClass(String name, java.nio.ByteBuffer b,
181 CodeSource cs)
182 {
183 return defineClass(name, b, getProtectionDomain(cs));
184 }
185
186 /**
187 * Returns the permissions for the given CodeSource object.
188 * <p>
|
111 * @spec JPMS
112 */
113 protected SecureClassLoader(String name, ClassLoader parent) {
114 super(name, parent);
115 }
116
117 /**
118 * Converts an array of bytes into an instance of class Class,
119 * with an optional CodeSource. Before the
120 * class can be used it must be resolved.
121 * <p>
122 * If a non-null CodeSource is supplied a ProtectionDomain is
123 * constructed and associated with the class being defined.
124 *
125 * @param name the expected name of the class, or {@code null}
126 * if not known, using '.' and not '/' as the separator
127 * and without a trailing ".class" suffix.
128 * @param b the bytes that make up the class data. The bytes in
129 * positions {@code off} through {@code off+len-1}
130 * should have the format of a valid class file as defined by
131 * <cite>The Java Virtual Machine Specification</cite>.
132 * @param off the start offset in {@code b} of the class data
133 * @param len the length of the class data
134 * @param cs the associated CodeSource, or {@code null} if none
135 * @return the {@code Class} object created from the data,
136 * and optional CodeSource.
137 * @throws ClassFormatError if the data did not contain a valid class
138 * @throws IndexOutOfBoundsException if either {@code off} or
139 * {@code len} is negative, or if
140 * {@code off+len} is greater than {@code b.length}.
141 *
142 * @throws SecurityException if an attempt is made to add this class
143 * to a package that contains classes that were signed by
144 * a different set of certificates than this class, or if
145 * the class name begins with "java.".
146 */
147 protected final Class<?> defineClass(String name,
148 byte[] b, int off, int len,
149 CodeSource cs)
150 {
151 return defineClass(name, b, off, len, getProtectionDomain(cs));
152 }
153
154 /**
155 * Converts a {@link java.nio.ByteBuffer ByteBuffer}
156 * into an instance of class {@code Class}, with an optional CodeSource.
157 * Before the class can be used it must be resolved.
158 * <p>
159 * If a non-null CodeSource is supplied a ProtectionDomain is
160 * constructed and associated with the class being defined.
161 *
162 * @param name the expected name of the class, or {@code null}
163 * if not known, using '.' and not '/' as the separator
164 * and without a trailing ".class" suffix.
165 * @param b the bytes that make up the class data. The bytes from positions
166 * {@code b.position()} through {@code b.position() + b.limit() -1}
167 * should have the format of a valid class file as defined by
168 * <cite>The Java Virtual Machine Specification</cite>.
169 * @param cs the associated CodeSource, or {@code null} if none
170 * @return the {@code Class} object created from the data,
171 * and optional CodeSource.
172 * @throws ClassFormatError if the data did not contain a valid class
173 * @throws SecurityException if an attempt is made to add this class
174 * to a package that contains classes that were signed by
175 * a different set of certificates than this class, or if
176 * the class name begins with "java.".
177 *
178 * @since 1.5
179 */
180 protected final Class<?> defineClass(String name, java.nio.ByteBuffer b,
181 CodeSource cs)
182 {
183 return defineClass(name, b, getProtectionDomain(cs));
184 }
185
186 /**
187 * Returns the permissions for the given CodeSource object.
188 * <p>
|