InputStream为啥是空指针

InputStream为何是空指针?这段代码为什么inputstream的对象is是空指针???因为文件内没有内容 ?try {FileOu

InputStream为何是空指针?
这段代码为什么inputstream的对象is是空指针???因为文件内没有内容 ?


    try {
        FileOutputStream fos = new FileOutputStream("C:\\Documents and Settings\\Administrator\\1" );
        InputStream is = test.class.getClassLoader().getResourceAsStream("1");
        //t.copyAll(is, fos);
        fos.close();
        is.close();
      } catch (Exception f) {
        //try to load anyways - could be a sharing violation
      }

[解决办法]
LZ想得到的效果是什么
[解决办法]
那个"1"目录有问题吧....
[解决办法]
getResourceAsStream默认从环境变量的classpath中查找,未找到文件名为“1”的文件。
[解决办法]
没有找到文件而不是文件中没有内容
[解决办法]
文件中没有内容是不会为null的,应该是没找到对应的文件