private static String parseFirebaseUrl(String firebaseSnippet){
  int idx=firebaseSnippet.indexOf("databaseURL");
  if (-1 == idx) {
    throw new RuntimeException("Please copy your Firebase web snippet into " + FIREBASE_SNIPPET_PATH);
  }
  idx=firebaseSnippet.indexOf(':',idx);
  int openQuote=firebaseSnippet.indexOf('"',idx);
  int closeQuote=firebaseSnippet.indexOf('"',openQuote + 1);
  return firebaseSnippet.substring(openQuote + 1,closeQuote);
}

private static String parseFirebaseUrl ( String firebaseSnippet ) { int idx = firebaseSnippet . indexOf ( "databaseURL" ) ; if ( - 1 == idx ) { throw new RuntimeException ( "Please copy your Firebase web snippet into " + FIREBASE_SNIPPET_PATH ) ; } idx = firebaseSnippet . indexOf ( ':' , idx ) ; int openQuote = firebaseSnippet . indexOf ( '"' , idx ) ; int closeQuote = firebaseSnippet . indexOf ( '"' , openQuote + 1 ) ; return firebaseSnippet . substring ( openQuote + 1 , closeQuote ) ; }
parses out the firebase database url from the client - side code snippet . the code snippet is a piece of javascript that defines an object with the key ' databaseurl ' . so look for that key , then parse out its quote - surrounded value .
