I am using this code to move files in row in my C# application.
public static bool IsFileReady(String sFilename)
{
try
{
using (FileStream inputStream = File.Open(sFilename, FileMode.Open, FileAccess.Read, FileShare.None))
{
if (inputStream.Length > 0)
{
return true;
}
else
{
return false;
}
}
}
catch (Exception)
{
return false;
}
}
And to use it:
while (Checker.bFileIsFileReady(sFilename))
{
//Do work here
break;
}
Can you please tell me, how I can translate this code to java? Right now, my java application works with Thread.Sleep()...