private def detectGraphFormat()

in cassovary-examples/src/main/scala/HelloLoadSharedGraph.scala [47:67]


  private def detectGraphFormat(directory: String, prefixFileNames: String) = {
    val validFiles = IoUtils.readFileNames(directory, prefixFileNames)
    if (validFiles.isEmpty) {
      println(s"No file starting with $prefixFileNames found in $directory!")
      System.exit(-1)
    }
    val name = validFiles(0)
    val formatReader = new FileReader[Char](name) {
      def processOneLine(line: String) = {
        val index = line.indexWhere(c => c < '0' || c > '9')
        if (index == -1) {
          println(s"Unable to infer format type of file $name in directory $directory!")
          System.exit(-1)
          -1.toChar
        } else line(index)
      }
    }
    val separator = formatReader.next()
    formatReader.close()
    separator
  }