I have connected to an **ftp location** using;

```
URL url = new URL("ftp://user:password@mydomain.com/" + file_name +";type=i");

```

I read the content into a byte array as shown below;

```
byte[] buffer = new byte[1024];
int count = 0;
while((count = fis.read(buffer)) > 0) 
{
    //check if bytes in buffer is a file
}

```

I want to be able to check if the bytes in `buffer` is a file without explicitly passing a specific file to write to it like;

```
    File xfile= new File("dir1/");
    FileOutputStream fos = new FileOutputStream(xfile);
    fos.write(bytes);

    if(xfile.isFile())
    {

    }

```

**In an Ideal world something like this;**

```
    File xfile = new File(buffer);//Note: you cannot do this in java
    if(xfile.isFile())
    {

    }

```

`isFile()` is to check if the bytes read from the ftp is file. I don't want to pass an explicit **file name** as I do not know the name of the file on the **ftp location**.

Any solutions available?