Translate

Thursday, August 27, 2015

Every method in Java String class with an array

Here's another example of what Class Viewer can give you in terms of information about a class as here are all the public methods in the String class with an array in any way shape or form, and I'll explain after why I got it:

static String valueOf(char[])
static String valueOf(char[],int,int)
static String copyValueOf(char[])
static String copyValueOf(char[],int,int)
static String format(Locale,String,Object[])
static String format(String,Object[])
void getBytes(int,int,byte[],int)
byte[] getBytes(java.nio.charset.Charset)
byte[] getBytes(String) throws UnsupportedEncodingException
byte[] getBytes()
void getChars(int,int,char[],int)
static String join(CharSequence,CharSequence[])
String[] split(String)
String[] split(String,int)
char[] toCharArray()

Oh and I got that list by highlighting the methods in the Results Window and using Ctrl-C. Then just copied over and decided to bold it for visibility. If you right click that doesn't work, as, um, I didn't build it to work, so that's on my to-do list now as a fix. Right now on three year schedule for updates I think. So next scheduled update to the extent anything is scheduled is 2018.

So there are 15 public methods in the Java String class that handle an array, either taking one or giving one, which is maybe a factoid and answer to a trivia contest as I don't know what use it is, but it demonstrates the kinds of things you can do.

And I got that list by double-clicking on the symbol for array which is [] in the list of methods in the left screen.

Found myself checking my Class Viewer after a Java update which is a habit. For those wondering about support for the project, most of my concern is with making sure latest updates to the Java language haven't changed how it behaves.

This time was very useful as I thought I had updated to Java 8 Version 60 which is the latest and checked my version in Class Viewer and it said 1.8.0_25, which is Java 8 Version 25, and yes I could have my program display it that way, but I don't want to keep up with it that closely, so it just gives you direct what Java says its version is.

So I updated, again. Not sure why I had to do it twice, but at least I knew.

It now says: Java version 1.8.0_60

Then doing my routine tests found that Chrome browser didn't work. Got some message asking if I wanted to restart Chrome. First I said no, and nothing. Tried again, and said yes, and nothing, so switched in ClassViewerConfig.xml to Firefox, restarted the program which you have to do so it reloads the config file, and it worked ok. So not sure if was some one-time thing or if Google has done something with Chrome, where it doesn't let my program open it. (But maybe am just being paranoid. Will edit later if it works later.)

And that was enough work for the morning.

So yes, maintain Class Viewer so keep up with how it works when there are updates to Java. And oh yeah, wouldn't mind feedback. I've never gotten any unsolicited.

So for over a decade it's been figure out what I think would be good, find bugs if I notice them, and that's how development goes. Feel free to point out anything I should know in the comments below.


James Harris
Post a Comment