Removed duplicate/unnececary code in DiscUtil.
This commit is contained in:
parent
eba564e54b
commit
68597da958
@ -59,7 +59,6 @@ public class DiscUtil {
|
|||||||
private static HashMap<String, Lock> locks = new HashMap<String, Lock>();
|
private static HashMap<String, Lock> locks = new HashMap<String, Lock>();
|
||||||
|
|
||||||
public static boolean writeCatch(final File file, final String content, boolean sync) {
|
public static boolean writeCatch(final File file, final String content, boolean sync) {
|
||||||
final byte[] bytes = utf8(content);
|
|
||||||
String name = file.getName();
|
String name = file.getName();
|
||||||
final Lock lock;
|
final Lock lock;
|
||||||
|
|
||||||
@ -75,9 +74,7 @@ public class DiscUtil {
|
|||||||
if (sync) {
|
if (sync) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
FileOutputStream out = new FileOutputStream(file);
|
write(file, content);
|
||||||
out.write(bytes);
|
|
||||||
out.close();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
@ -89,9 +86,7 @@ public class DiscUtil {
|
|||||||
public void run() {
|
public void run() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
FileOutputStream out = new FileOutputStream(file);
|
write(file, content);
|
||||||
out.write(bytes);
|
|
||||||
out.close();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user