protected String[] splitIntoLines(String image) {
    LinkedList  lines = new LinkedList();
    int         index = 0;
    int         start = 0;
    
    while (index < image.length()) {
      switch (image.charAt(index)) {
      case '\r':
        lines.add(image.substring(start, index));
        if (index + 1 < image.length() && image.charAt(index + 1) == '\n') {
          index += 2;
        } else {
          index++;
        }
        start = index;
        break;
      case '\n':
        lines.add(image.substring(start, index));
        start = ++index;
        break;
      default:
        index++;
      }
    }
    
    if (start < index || start > 0) {
      lines.add(image.substring(start, index));
    }
  
    return (String[])lines.toArray(new String[lines.size()]);
  }