From a535f865fdc59978a3ec96f949a8d742cec03562 Mon Sep 17 00:00:00 2001 From: "changhyun1.lee" Date: Mon, 25 Jul 2011 22:51:52 +0900 Subject: [PATCH] [WAC] added license boilerplate Change-Id: Ifa9269425aeca25fac04c6a08958710a58ab4402 --- .../src/com/samsung/ide/common/util/FileUtil.java | 179 +++++++++++---------- .../src/com/samsung/ide/common/util/OSChecker.java | 10 +- .../src/com/samsung/ide/common/util/SWTUtil.java | 10 +- .../com/samsung/ide/common/util/StringUtil.java | 10 +- .../src/com/samsung/ide/common/util/ViewUtil.java | 13 +- 5 files changed, 110 insertions(+), 112 deletions(-) diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/FileUtil.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/FileUtil.java index da40be9..9cadf47 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/FileUtil.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/FileUtil.java @@ -1,7 +1,7 @@ -/**************************************************************************************** - * Copyright (c) 2010 Samsung Electronics Co. - * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html - ****************************************************************************************/ +/******************************************************************************* + * Copyright (c) 2011 Samsung Electronics Co. + * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package com.samsung.ide.common.util; @@ -12,91 +12,92 @@ import java.io.IOException; import java.io.InputStreamReader; /** - * @author changhyun1.lee@samsung.com, S-Core. - initial creation + * @author Changhyun Lee {@literal } (S-Core) */ public class FileUtil { - private static final int BUFFER_SIZE = 8192; - - /** - * read text from given file - */ - public static String readTextFile(File file, String encoding) throws IOException { - StringBuilder text = new StringBuilder(); - char[] buffer = new char[BUFFER_SIZE]; - BufferedReader in = null; - - if (encoding == null) { // if encoding is not set then use default encoding - encoding = System.getProperty("file.encoding"); - } - - try { - in = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding), BUFFER_SIZE); - int nRead = 0; - while ((nRead = in.read(buffer, 0, buffer.length)) > 0) { - text.append(buffer, 0, nRead); - } - } finally { - if (in != null) { - in.close(); - } - } - - return text.toString(); - } - - /** - * return file extension from given full file name - * - * @author jihoon80.song@samsung.com, S-Core Inc. - */ - public static String getFileExtension(String fullName) { - if (fullName == null) { - return null; - } - - int k = fullName.lastIndexOf("."); - - return (k != -1) ? fullName.substring(k + 1, fullName.length()) : null; - } - - /** - * return file name without file extension from given full file name - * - * @author jihoon80.song@samsung.com, S-Core Inc. - */ - public static String getFileNameWithoutExtension(String fullName) { - if (fullName == null) { - return null; - } - - int k = fullName.lastIndexOf("."); - - return (k != -1) ? fullName.substring(0, k) : fullName; - } - - /** - * delete file and its children. - * - * @author jihoon80.song@samsung.com, S-Core Inc. - */ - public static boolean recursiveDelete(File file) { - boolean result = true; - - if (file == null) { - return false; - } - - // delete child - if (file.isDirectory()) { - File[] children = file.listFiles(); - for (File child : children) { - result &= recursiveDelete(child); - } - } - - // delete self - result &= file.delete(); - - return result; - } + private static final int BUFFER_SIZE = 8192; + + /** + * read text from given file + */ + public static String readTextFile(File file, String encoding) throws IOException { + StringBuilder text = new StringBuilder(); + char[] buffer = new char[BUFFER_SIZE]; + BufferedReader in = null; + + if (encoding == null) { // if encoding is not set then use default encoding + encoding = System.getProperty("file.encoding"); + } + + try { + in = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding), BUFFER_SIZE); + int nRead = 0; + while ((nRead = in.read(buffer, 0, buffer.length)) > 0) { + text.append(buffer, 0, nRead); + } + } finally { + if (in != null) { + in.close(); + } + } + + return text.toString(); + } + + /** + * return file extension from given full file name + * + * @author jihoon80.song@samsung.com, S-Core Inc. + */ + public static String getFileExtension(String fullName) { + if (fullName == null) { + return null; + } + + int k = fullName.lastIndexOf("."); + + return (k != -1) ? fullName.substring(k + 1, fullName.length()) : null; + } + + /** + * return file name without file extension from given full file name + * + * @author jihoon80.song@samsung.com, S-Core Inc. + */ + public static String getFileNameWithoutExtension(String fullName) { + if (fullName == null) { + return null; + } + + int k = fullName.lastIndexOf("."); + + return (k != -1) ? fullName.substring(0, k) : fullName; + } + + /** + * delete file and its children. + * + * @author jihoon80.song@samsung.com, S-Core Inc. + */ + public static boolean recursiveDelete(File file) { + boolean result = true; + + if (file == null) { + return false; + } + + // delete child + if (file.isDirectory()) { + File[] children = file.listFiles(); + for (File child : children) { + result &= recursiveDelete(child); + } + } + + // delete self + result &= file.delete(); + + return result; + } + } diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/OSChecker.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/OSChecker.java index beafbab..9e97ba3 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/OSChecker.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/OSChecker.java @@ -1,12 +1,12 @@ -/**************************************************************************************** - * Copyright (c) 2010 Samsung Electronics Co. - * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html - ****************************************************************************************/ +/******************************************************************************* + * Copyright (c) 2011 Samsung Electronics Co. + * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package com.samsung.ide.common.util; /** - * @author changhyun1.lee@samsung.com, S-Core. + * @author Changhyun Lee {@literal } (S-Core) *
    *
  • initial creation *
  • thanks to Yoon Kyung Koo diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/SWTUtil.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/SWTUtil.java index d9ade33..996827d 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/SWTUtil.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/SWTUtil.java @@ -1,7 +1,7 @@ -/**************************************************************************************** - * Copyright (c) 2011 S-Core Co. - * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html - ****************************************************************************************/ +/******************************************************************************* + * Copyright (c) 2011 Samsung Electronics Co. + * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package com.samsung.ide.common.util; @@ -54,7 +54,7 @@ public class SWTUtil { * Creates SWT ScrolledComposite. * * @return ScrolledComposite - * @author changhyun1.lee@samsung.com, S-Core Inc. + * @author Changhyun Lee {@literal } (S-Core) */ public static ScrolledComposite createScrolledComposite(Composite parent) { ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/StringUtil.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/StringUtil.java index e2852e4..f3235a2 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/StringUtil.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/StringUtil.java @@ -1,7 +1,7 @@ -/**************************************************************************************** - * Copyright (c) 2010 Samsung Electronics Co. - * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html - ****************************************************************************************/ +/******************************************************************************* + * Copyright (c) 2011 Samsung Electronics Co. + * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package com.samsung.ide.common.util; @@ -12,7 +12,7 @@ import java.util.List; import java.util.StringTokenizer; /** - * @author changhyun1.lee@samsung.com, S-Core. + * @author Changhyun Lee {@literal } (S-Core) *
      *
    • initial creation *
    • added trimToNull method. diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/ViewUtil.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/ViewUtil.java index 0957354..f90175c 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/ViewUtil.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/ViewUtil.java @@ -1,7 +1,7 @@ -/**************************************************************************************** - * Copyright (c) 2010 Samsung Electronics Co. - * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html - ****************************************************************************************/ +/******************************************************************************* + * Copyright (c) 2011 Samsung Electronics Co. + * For conditions of distribution and use, see http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package com.samsung.ide.common.util; @@ -15,10 +15,7 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; /** - * @author changhyun1.lee@samsung.com, S-Core. - *
        - *
      • initial creation - *
      + * @author Changhyun Lee {@literal } (S-Core) */ public class ViewUtil { public static void showView(final String id, boolean sync) { -- 2.7.4