java!!环境在linux里面:FileInputStream读取文件的时候http://变成http:/丢掉了一个斜杠
代码如下:
debuglog.debug("filePath " + filePath);
BufferedInputStream in = new BufferedInputStream(new FileInputStream(
filePath));
日志打出来:
http://xxx.xxx.xxx.xxx:80/02100490113004/WallpaperImg/caitiao_360x640.jpg
这里很明显http://这两个斜杠都还存在
但是一走到下面读取这个文件的时候就报错了
java.io.FileNotFoundException: http:/xxx.xxx.xxx.xxx:80/02100490113004/WallpaperImg/caitiao_360x640.jpg (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.huawei.wallpaper.action.WallPaperAction.fileToByteArray(WallPaperAction.java:176)
at com.huawei.wallpaper.action.WallPaperAction.sendMMS(WallPaperAction.java:120)
这个报错的原因就是因为少了一个斜杠,所以就报找不到文件,我很无语
如果说这个读取的时候自动把双斜杠转换成单斜杠,那我就没办法了,因为我也测试过相对路径,也无法获取到。