< prev index next >

src/hotspot/share/oops/symbol.hpp

Print this page

223   bool ends_with(char suffix_char) const {
224     return contains_byte_at(utf8_length() - 1, suffix_char);
225   }
226 
227   // Tests if the symbol contains the given utf8 substring
228   // at the given byte position.
229   bool contains_utf8_at(int position, const char* substring, int len) const {
230     assert(len >= 0 && substring != nullptr, "substring must be valid");
231     if (position < 0)  return false;  // can happen with ends_with
232     if (position + len > utf8_length()) return false;
233     return (memcmp((char*)base() + position, substring, len) == 0);
234   }
235 
236   // Tests if the symbol contains the given byte at the given position.
237   bool contains_byte_at(int position, char code_byte) const {
238     if (position < 0)  return false;  // can happen with ends_with
239     if (position >= utf8_length()) return false;
240     return code_byte == char_at(position);
241   }
242 









243   // Test if the symbol has the give substring at or after the i-th char.
244   int index_of_at(int i, const char* substr, int substr_len) const;
245 
246   // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
247   // note that the ordering is not alfabetical
248   inline int fast_compare(const Symbol* other) const;
249 
250   // Returns receiver converted to null-terminated UTF-8 string; string is
251   // allocated in resource area, or in the char buffer provided by caller.
252   char* as_C_string() const;
253   char* as_C_string(char* buf, int size) const;
254 
255   // Returns an escaped form of a Java string.
256   char* as_quoted_ascii() const;
257 
258   // Returns a null terminated utf8 string in a resource array
259   char* as_utf8() const { return as_C_string(); }
260 
261   jchar* as_unicode(int& length) const;
262 

223   bool ends_with(char suffix_char) const {
224     return contains_byte_at(utf8_length() - 1, suffix_char);
225   }
226 
227   // Tests if the symbol contains the given utf8 substring
228   // at the given byte position.
229   bool contains_utf8_at(int position, const char* substring, int len) const {
230     assert(len >= 0 && substring != nullptr, "substring must be valid");
231     if (position < 0)  return false;  // can happen with ends_with
232     if (position + len > utf8_length()) return false;
233     return (memcmp((char*)base() + position, substring, len) == 0);
234   }
235 
236   // Tests if the symbol contains the given byte at the given position.
237   bool contains_byte_at(int position, char code_byte) const {
238     if (position < 0)  return false;  // can happen with ends_with
239     if (position >= utf8_length()) return false;
240     return code_byte == char_at(position);
241   }
242 
243   // True if this is a descriptor for a method with void return.
244   // (Assumes it is a valid descriptor.)
245   bool is_void_method_signature() const {
246     return starts_with('(') && ends_with('V');
247   }
248 
249   Symbol* fundamental_name(TRAPS);
250   bool is_same_fundamental_type(Symbol*) const;
251 
252   // Test if the symbol has the give substring at or after the i-th char.
253   int index_of_at(int i, const char* substr, int substr_len) const;
254 
255   // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
256   // note that the ordering is not alfabetical
257   inline int fast_compare(const Symbol* other) const;
258 
259   // Returns receiver converted to null-terminated UTF-8 string; string is
260   // allocated in resource area, or in the char buffer provided by caller.
261   char* as_C_string() const;
262   char* as_C_string(char* buf, int size) const;
263 
264   // Returns an escaped form of a Java string.
265   char* as_quoted_ascii() const;
266 
267   // Returns a null terminated utf8 string in a resource array
268   char* as_utf8() const { return as_C_string(); }
269 
270   jchar* as_unicode(int& length) const;
271 
< prev index next >