Ребят,нужно прочитать файл в одной кодировке Windows-1251 и записать в другой UTF-8. В чем у меня ошибка?
public class Solution {
    public static void main(String[] args) throws IOException {//Windows-1251 , UTF-8
        try(InputStream fin = new FileInputStream(args[0]); OutputStream fout = new FileOutputStream(args[1])){
              byte[] buffer = new byte[1000];
              int count;
              while (fin.available()>0){
                  count = fin.read(buffer);
                  String s = new String(buffer, "Windows-1251");
                  buffer = s.getBytes("UTF-8");
                  if(count!=-1) fout.write(buffer,0,count);
              }

        }catch (Exception e){}

    }
}