国产视频最新网址|这里只有精品中文字幕情侣酒店|精品成人一区二区|91久久蜜桃网站|AV成人电影五区|欧美精品在线一区|秋霞午夜一区日韩|国产午夜成人免费看片不卡|98精品美女视频日韩一区精品视频|亚洲综合久久国产不卡日本岛国久久

SUN認(rèn)證考試知識點(diǎn):java讀取文件內(nèi)容的函數(shù)

時間:2024-05-30 11:38:31 SUN認(rèn)證 我要投稿
  • 相關(guān)推薦

SUN認(rèn)證考試知識點(diǎn):java讀取文件內(nèi)容的函數(shù)

  public static String readFile(String fileName) {

SUN認(rèn)證考試知識點(diǎn):java讀取文件內(nèi)容的函數(shù)

  String output = "";

  File file = new File(fileName);

  if (file.exists()) {

  if (file.isFile()) {

  try {

  BufferedReader input = new BufferedReader(new FileReader(

  file));

  StringBuffer buffer = new StringBuffer();

  String text;

  while ((text = input.readLine()) != null)

  buffer.append(text + "\n");

  output = buffer.toString();

  } catch (IOException ioException) {

  System.err.println("File Error!");

  }

  } else if (file.isDirectory()) {

  String[] dir = file.list();

  output += "Directory contents:\n";

  for (int i = 0; i < dir.length; i++) {

  output += dir[i] + "\n";

  }

  }

  } else {

  System.err.println("Does not exist!");

  }

  return output;

  }

  public static void main(String args[]) {

  Map ab = new HashMap();

  String str = readFile("C:/AbCircuitInfo");

  String[] temp=str.split("\\n");

  for (int i = 0; i < temp.length; i++) {

  ab.put(temp[i].substring(0,temp[i].indexOf(",")), temp[i].substring(temp[i].indexOf(",")+1,temp[i].length()));

  }

  }

【SUN認(rèn)證考試知識點(diǎn):java讀取文件內(nèi)容的函數(shù)】相關(guān)文章:

sun java認(rèn)證考試介紹10-23

Sun java認(rèn)證考試答案11-06

Sun Java認(rèn)證考試科目08-30

sun java認(rèn)證考試報(bào)考指南10-18

SUN JAVA認(rèn)證介紹08-09

SUN認(rèn)證考試知識點(diǎn):java servlet生命周期09-25

Sun認(rèn)證Java開發(fā)員考試介紹10-09

sun認(rèn)證考試:Java.io的使用08-23

Sun Java認(rèn)證考試教材教輔09-13

Sun java認(rèn)證考試真題答案09-25