rename choosenFile
This commit is contained in:
parent
b1a83a95f6
commit
63a6688fc8
|
@ -134,20 +134,20 @@ public final class SibaManager
|
|||
/**
|
||||
* This method is used to check the file.
|
||||
*
|
||||
* @param choosenFile
|
||||
* @param md5FileToCheck
|
||||
* the file to check
|
||||
* @return the result of check
|
||||
* @throws SibaException
|
||||
* specific exception
|
||||
*/
|
||||
public static boolean check(final File choosenFile) throws SibaException
|
||||
public static boolean check(final File md5FileToCheck) throws SibaException
|
||||
{
|
||||
boolean result;
|
||||
|
||||
try
|
||||
{
|
||||
String md5String = SibaUtils.loadMD5Sum(choosenFile);
|
||||
File fileToCheck1 = SibaUtils.readFileNameToCheck(choosenFile);
|
||||
String md5String = SibaUtils.loadMD5Sum(md5FileToCheck);
|
||||
File fileToCheck1 = SibaUtils.readFileNameToCheck(md5FileToCheck);
|
||||
if (StringUtils.equals(md5String, SibaUtils.md5(fileToCheck1)))
|
||||
{
|
||||
result = true;
|
||||
|
|
|
@ -115,22 +115,22 @@ public final class SibaUtils
|
|||
|
||||
/**
|
||||
*
|
||||
* @param choosenFile
|
||||
* @param md5File
|
||||
* the file to check
|
||||
* @return The MD5sum
|
||||
* @throws IOException
|
||||
* IOException
|
||||
*/
|
||||
public static String loadMD5Sum(final File choosenFile) throws IOException
|
||||
public static String loadMD5Sum(final File md5File) throws IOException
|
||||
{
|
||||
String result;
|
||||
|
||||
FileReader in = null;
|
||||
try
|
||||
{
|
||||
if (choosenFile.exists() && (choosenFile.length() > 32))
|
||||
if (md5File.exists() && (md5File.length() > 32))
|
||||
{
|
||||
in = new FileReader(choosenFile);
|
||||
in = new FileReader(md5File);
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
String line = bufferedReader.readLine();
|
||||
result = line.substring(0, 32);
|
||||
|
@ -208,30 +208,30 @@ public final class SibaUtils
|
|||
|
||||
/**
|
||||
*
|
||||
* @param choosenFile
|
||||
* @param md5File
|
||||
* The MD5file
|
||||
* @return the file to check
|
||||
* @throws IOException
|
||||
* IOException
|
||||
*/
|
||||
public static File readFileNameToCheck(final File choosenFile) throws IOException
|
||||
public static File readFileNameToCheck(final File md5File) throws IOException
|
||||
{
|
||||
File result;
|
||||
|
||||
FileReader in = null;
|
||||
try
|
||||
{
|
||||
if (choosenFile.exists() && (choosenFile.length() > 32))
|
||||
if (md5File.exists() && (md5File.length() > 32))
|
||||
{
|
||||
in = new FileReader(choosenFile);
|
||||
in = new FileReader(md5File);
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
String line = bufferedReader.readLine();
|
||||
String fileNameToString;
|
||||
fileNameToString = line.substring(33);
|
||||
in.close();
|
||||
if (choosenFile.isAbsolute())
|
||||
if (md5File.isAbsolute())
|
||||
{
|
||||
result = new File(choosenFile.getParent(), fileNameToString);
|
||||
result = new File(md5File.getParent(), fileNameToString);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue