< prev index next >

src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java

Print this page




  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.internal.misc;
  27 
  28 import java.lang.annotation.Annotation;
  29 import java.lang.module.ModuleDescriptor;
  30 import java.lang.reflect.Executable;
  31 import java.lang.reflect.Method;
  32 import java.net.URI;

  33 import java.security.AccessControlContext;
  34 import java.security.ProtectionDomain;
  35 import java.util.Iterator;
  36 import java.util.List;
  37 import java.util.Map;
  38 import java.util.concurrent.ConcurrentHashMap;
  39 import java.util.stream.Stream;
  40 
  41 import jdk.internal.module.ServicesCatalog;
  42 import jdk.internal.reflect.ConstantPool;
  43 import sun.reflect.annotation.AnnotationType;
  44 import sun.nio.ch.Interruptible;
  45 
  46 public interface JavaLangAccess {
  47 
  48     /**
  49      * Returns the list of {@code Method} objects for the declared public
  50      * methods of this class or interface that have the specified method name
  51      * and parameter types.
  52      */


 237      * Returns true if module m reflectively opens a package to other
 238      */
 239     boolean isReflectivelyOpened(Module module, String pn, Module other);
 240 
 241     /**
 242      * Returns the ServicesCatalog for the given Layer.
 243      */
 244     ServicesCatalog getServicesCatalog(ModuleLayer layer);
 245 
 246     /**
 247      * Returns an ordered stream of layers. The first element is the
 248      * given layer, the remaining elements are its parents, in DFS order.
 249      */
 250     Stream<ModuleLayer> layers(ModuleLayer layer);
 251 
 252     /**
 253      * Returns a stream of the layers that have modules defined to the
 254      * given class loader.
 255      */
 256     Stream<ModuleLayer> layers(ClassLoader loader);






























 257 
 258     /**
 259      * Returns a new string by decoding from the given utf8 bytes array.
 260      *
 261      * @param off the index of the first byte to decode
 262      * @param len the number of bytes to decode
 263      * @return the newly created string
 264      * @throws IllegalArgumentException for malformed or unmappable bytes.
 265      */
 266     String newStringUTF8NoRepl(byte[] bytes, int off, int len);
 267 
 268     /**
 269      * Encode the given string into a sequence of bytes using utf8.
 270      *
 271      * @param s the string to encode
 272      * @return the encoded bytes in utf8
 273      * @throws IllegalArgumentException for malformed surrogates
 274      */
 275     byte[] getBytesUTF8NoRepl(String s);
 276 }


  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.internal.misc;
  27 
  28 import java.lang.annotation.Annotation;
  29 import java.lang.module.ModuleDescriptor;
  30 import java.lang.reflect.Executable;
  31 import java.lang.reflect.Method;
  32 import java.net.URI;
  33 import java.nio.charset.Charset;
  34 import java.security.AccessControlContext;
  35 import java.security.ProtectionDomain;
  36 import java.util.Iterator;
  37 import java.util.List;
  38 import java.util.Map;
  39 import java.util.concurrent.ConcurrentHashMap;
  40 import java.util.stream.Stream;
  41 
  42 import jdk.internal.module.ServicesCatalog;
  43 import jdk.internal.reflect.ConstantPool;
  44 import sun.reflect.annotation.AnnotationType;
  45 import sun.nio.ch.Interruptible;
  46 
  47 public interface JavaLangAccess {
  48 
  49     /**
  50      * Returns the list of {@code Method} objects for the declared public
  51      * methods of this class or interface that have the specified method name
  52      * and parameter types.
  53      */


 238      * Returns true if module m reflectively opens a package to other
 239      */
 240     boolean isReflectivelyOpened(Module module, String pn, Module other);
 241 
 242     /**
 243      * Returns the ServicesCatalog for the given Layer.
 244      */
 245     ServicesCatalog getServicesCatalog(ModuleLayer layer);
 246 
 247     /**
 248      * Returns an ordered stream of layers. The first element is the
 249      * given layer, the remaining elements are its parents, in DFS order.
 250      */
 251     Stream<ModuleLayer> layers(ModuleLayer layer);
 252 
 253     /**
 254      * Returns a stream of the layers that have modules defined to the
 255      * given class loader.
 256      */
 257     Stream<ModuleLayer> layers(ClassLoader loader);
 258 
 259     /**
 260      * Constructs a new {@code String} by decoding the specified subarray of
 261      * bytes using the specified {@linkplain java.nio.charset.Charset charset}.
 262      *
 263      * The caller of this method shall relinquish and transfer the ownership of
 264      * the byte array to the callee since the later will not make a copy.
 265      *
 266      * @param bytes the byte array source
 267      * @param cs the Charset
 268      * @return the newly created string
 269      * @throws IllegalArgumentException for malformed or unmappable bytes
 270      */
 271     String newStringNoRepl(byte[] bytes, Charset cs);
 272 
 273     /**
 274      * Encode the given string into a sequence of bytes using the specified Charset.
 275      *
 276      * This method avoids copying the String's internal representation if the input
 277      * is ASCII.
 278      *
 279      * This method throws IllegalArgumentException instead of replacing when
 280      * malformed input or unmappable characters are encountered.
 281      *
 282      * @param s the string to encode
 283      * @param cs the charset
 284      * @return the encoded bytes
 285      * @throws IllegalArgumentException for malformed input or unmappable characters
 286      */
 287     byte[] getBytesNoRepl(String s, Charset cs);
 288 
 289     /**
 290      * Returns a new string by decoding from the given utf8 bytes array.
 291      *
 292      * @param off the index of the first byte to decode
 293      * @param len the number of bytes to decode
 294      * @return the newly created string
 295      * @throws IllegalArgumentException for malformed or unmappable bytes.
 296      */
 297     String newStringUTF8NoRepl(byte[] bytes, int off, int len);
 298 
 299     /**
 300      * Encode the given string into a sequence of bytes using utf8.
 301      *
 302      * @param s the string to encode
 303      * @return the encoded bytes in utf8
 304      * @throws IllegalArgumentException for malformed surrogates
 305      */
 306     byte[] getBytesUTF8NoRepl(String s);
 307 }
< prev index next >