Issue#22 updated SibaUtils
This commit is contained in:
parent
6f507c7d27
commit
2925a8090b
@ -43,19 +43,19 @@ public class SibaUtils
|
||||
*
|
||||
* This method Generate the file with MD5.
|
||||
*
|
||||
* @param inputDirectory
|
||||
* @param inputFile
|
||||
* @param target
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static File createMD5File(final File inputDirectory, final String target)
|
||||
public static File createMD5File(final File inputFile, final String target)
|
||||
throws IOException, NoSuchAlgorithmException
|
||||
{
|
||||
File result;
|
||||
|
||||
String md5 = SibaUtils.md5(inputDirectory);
|
||||
String fileName = inputDirectory.getName();
|
||||
String md5 = SibaUtils.md5(inputFile);
|
||||
String fileName = inputFile.getName();
|
||||
result = createMD5File(md5, fileName, target);
|
||||
|
||||
//
|
||||
@ -65,8 +65,7 @@ public class SibaUtils
|
||||
public static File createMD5File(final String md5, final String fileName, final String target) throws IOException
|
||||
{
|
||||
File result;
|
||||
FileWriter fileWriter;
|
||||
fileWriter = null;
|
||||
FileWriter fileWriter = null;
|
||||
try
|
||||
{
|
||||
result = new File(target);
|
||||
@ -95,17 +94,16 @@ public class SibaUtils
|
||||
public static String loadMD5Sum(final File choosenFile) throws IOException
|
||||
{
|
||||
String result;
|
||||
FileReader fileReader;
|
||||
fileReader = null;
|
||||
FileReader in = null;
|
||||
try
|
||||
{
|
||||
if (choosenFile.exists() && (choosenFile.length() > 32))
|
||||
{
|
||||
fileReader = new FileReader(choosenFile);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
in = new FileReader(choosenFile);
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
String line = bufferedReader.readLine();
|
||||
result = line.substring(0, 32);
|
||||
fileReader.close();
|
||||
in.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -114,7 +112,7 @@ public class SibaUtils
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(fileReader);
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
//
|
||||
return result;
|
||||
@ -181,19 +179,18 @@ public class SibaUtils
|
||||
public static File readFileNameToCheck(final File choosenFile) throws IOException
|
||||
{
|
||||
File result;
|
||||
FileReader fileReader;
|
||||
fileReader = null;
|
||||
FileReader in = null;
|
||||
try
|
||||
{
|
||||
// result = null;
|
||||
if (choosenFile.exists() && (choosenFile.length() > 32))
|
||||
{
|
||||
fileReader = new FileReader(choosenFile);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
in = new FileReader(choosenFile);
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
String line = bufferedReader.readLine();
|
||||
String fileNameToString = new String();
|
||||
fileNameToString = line.substring(33);
|
||||
fileReader.close();
|
||||
in.close();
|
||||
if (choosenFile.isAbsolute())
|
||||
{
|
||||
result = new File(choosenFile.getParent() + "/" + fileNameToString);
|
||||
@ -212,7 +209,7 @@ public class SibaUtils
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(fileReader);
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
//
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user