public class LinkFile{
public static void main(String[] args) throws IOException {
linkBinaryFile("Idea.jpg");
}
private static void linkBinaryFile(String fileName) throws IOException{
File imageFile = new File(fileName);
if(!imageFile.exists()||!imageFile.canRead()){
System.out.println("can not read the image or the image file doesn't exists");
System.exit(1);
}
long length = imageFile.length();
int ch = 0;
System.out.println(length);
byte[] buffer = new byte[(int)length/7];
InputStream image = new FileInputStream(imageFile);
File file = new File("hello.jpg");
if(!file.exists())
{
file.createNewFile();
}
FileOutputStream newFile = new FileOutputStream(file,true);
boolean go = true;
while(go)
{
System.out.println("please select how to read the file:\n"+
"1: read()\n2:read(byte[] buffer)\n3:read(byte[] buffer,int off,int len)\n");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
if(line.equals("1"))
{