IP가 다른 다른 컴퓨터에있는 텍스트 파일을 읽을 수 없습니다. 다음은 제 코드입니다. 살펴에게 그것을하시기 바랍니다 ..다른 컴퓨터에서 텍스트 파일을 읽을 수 없습니다.
URL url =
new URL("http://10.128.0.1/d:/kiranshare/testout.txt");
br = new BufferedReader(new InputStreamReader(is));
File file=new File(url.getFile());
System.out.println(file);
System.out.println(file.getAbsolutePath());
System.out.println(file.getName()+file.getParentFile());
System.out.println("url="+file);
// InputStream is = url.openStream();
System.out.println("is"+is);
ByteArrayOutputStream os = new ByteArrayOutputStream();
System.out.println("os"+os);
byte[] buf = new byte[4096];
int n;
while ((n = is.read(buf)) >= 0)
os.write(buf, 0, n);
os.close();
is.close();
byte[] data = os.toByteArray();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Please suggest me where I am doing wrong???
Thanks in Advance
질문 13 개가 허용됩니다. 그걸로 일 해줘. [how-accept-rate-works] (http://meta.stackexchange.com/questions/16721)를 참조하십시오. –