< prev index next >

src/hotspot/share/oops/symbol.hpp

Print this page

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






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

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