src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
changeset 50552 7439ceaae8e4
parent 49001 ce06058197a4
child 50820 35f52a3cd6bd
equal deleted inserted replaced
50551:367763702685 50552:7439ceaae8e4
    28 import java.lang.annotation.Annotation;
    28 import java.lang.annotation.Annotation;
    29 import java.lang.module.ModuleDescriptor;
    29 import java.lang.module.ModuleDescriptor;
    30 import java.lang.reflect.Executable;
    30 import java.lang.reflect.Executable;
    31 import java.lang.reflect.Method;
    31 import java.lang.reflect.Method;
    32 import java.net.URI;
    32 import java.net.URI;
       
    33 import java.nio.charset.Charset;
    33 import java.security.AccessControlContext;
    34 import java.security.AccessControlContext;
    34 import java.security.ProtectionDomain;
    35 import java.security.ProtectionDomain;
    35 import java.util.Iterator;
    36 import java.util.Iterator;
    36 import java.util.List;
    37 import java.util.List;
    37 import java.util.Map;
    38 import java.util.Map;
   254      * given class loader.
   255      * given class loader.
   255      */
   256      */
   256     Stream<ModuleLayer> layers(ClassLoader loader);
   257     Stream<ModuleLayer> layers(ClassLoader loader);
   257 
   258 
   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     /**
   259      * Returns a new string by decoding from the given utf8 bytes array.
   290      * Returns a new string by decoding from the given utf8 bytes array.
   260      *
   291      *
   261      * @param off the index of the first byte to decode
   292      * @param off the index of the first byte to decode
   262      * @param len the number of bytes to decode
   293      * @param len the number of bytes to decode
   263      * @return the newly created string
   294      * @return the newly created string