本文整理匯總了Java中ua.at.tsvetkov.util.Log.w方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.w方法的具體用法?Java Log.w怎麽用?Java Log.w使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ua.at.tsvetkov.util.Log
的用法示例。
在下文中一共展示了Log.w方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
@Override
public void parse(InputStream inputStream) throws Exception {
if (inputStream == null) {
Log.w("InputStream is null. Parsing aborted.");
return;
}
// BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
// String line;
// StringBuffer buffer = new StringBuffer();
// while ((line = reader.readLine()) != null) {
// buffer.append(line);
// }
// process(buffer.toString().trim());
// better performance
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
process(result.toString("UTF-8"));
}
示例2: saveToFile
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
private void saveToFile() throws IOException {
File f = new File(cacheFileName);
if (!request.isNeedToRewriteFile() && f.exists() && f.length() > 0) {
if (DataProcessor.getInstance().getConfiguration().isLogEnabled()) {
Log.w(FILE_EXIST + cacheFileName);
}
return;
}
FileOutputStream out = new FileOutputStream(cacheFileName);
byte[] buffer = new byte[BUFFER];
int bytesRead = -1;
inputStream = request.getInputStream();
while ((bytesRead = inputStream.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
out.flush();
out.close();
inputStream.close();
inputStream = new FileInputStream(cacheFileName);
}
示例3: getFileName
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Return file name with extension without directories.
*
* @param fullPath full path to file
* @return file name or empty string if fullPath have not include the correct filename.
*/
public static String getFileName(String fullPath) {
String fileName = "";
if (fullPath == null) {
Log.w("The path to file is null");
return fileName;
}
if (fullPath.length() == 0) {
Log.w("The path to file is empty");
return fileName;
}
int indexOf = fullPath.lastIndexOf(File.separator);
if (indexOf == -1) {
return fullPath;
}
try {
fileName = fullPath.substring(indexOf + 1, fullPath.length());
} catch (IndexOutOfBoundsException e) {
Log.wtf("IndexOutOfBoundsException in " + fullPath);
}
return fileName;
}
示例4: getFilePath
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Return path for this file without file name
*
* @param fullPath full path to file
* @return path without file name
*/
public static String getFilePath(String fullPath) {
String fileName = "";
if (fullPath == null) {
Log.w("The path to file is null");
return fileName;
}
if (fullPath.length() == 0) {
Log.w("The path to file is empty");
return fileName;
}
int pos = fullPath.lastIndexOf(File.separator);
if (pos != -1) {
fileName = fullPath.substring(0, pos + 1);
return fileName;
}
return "";
}
示例5: init
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Build new data processor with given configuration
*
* @param configuration new configuration
*/
public synchronized void init(DataProcessorConfiguration configuration) {
if (configuration == null) {
throw new IllegalArgumentException(ERROR_INIT_CONFIG_WITH_NULL);
}
if (this.configuration == null) {
if (configuration.isLogEnabled) {
Log.d(LOG_INIT_CONFIG);
}
this.configuration = configuration;
} else {
Log.w(WARNING_RE_INIT_CONFIG);
}
if (configuration.isThreadPoolEnabled) {
threadPool = new DataProcessorThreadPool();
}
if (configuration.isCacheEnabled()) {
processors = new ProcessorsCache(configuration.getCacheSize());
}
}
示例6: toString
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Return composed URL string from parts or null if not builded
*/
@Override
public String toString() {
if (sb != null) {
if (configuration.isCheckingRequestStringEnabled()) {
try {
return URLEncoder.encode(sb.toString(), encoding);
} catch (UnsupportedEncodingException e) {
Log.e(WRONG_URL, e);
return "";
}
} else {
return sb.toString();
}
} else {
if (configuration.isLogEnabled()) {
Log.w(REQUEST_IS_NOT_BUILD);
}
return null;
}
}
示例7: deleteDirContent
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Delete content from directory
*
* @param pathName path for delete a content
*/
public static void deleteDirContent(@NonNull String pathName) {
File path = new File(pathName);
String[] files = path.list();
if (files != null) {
for (String fileName : files) {
File file = new File(fileName);
boolean result = file.delete();
if (result) {
Log.v("File success deleted " + fileName);
} else {
Log.w("Fail to delete file " + fileName);
}
}
}
}
示例8: getBoolean
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean,
* or false otherwise and print warning in to LogCat.
*
* @param obj JSONObject
* @param name name of value
* @return boolean
*/
public boolean getBoolean(JSONObject obj, String name) {
boolean result = false;
try {
result = obj.getBoolean(name);
} catch (JSONException e) {
Log.w(this, name + " is not exist in this JSON object");
}
return result;
}
示例9: getInt
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Returns the value mapped by name if it exists and is an int or can be coerced to an int,
* or 0 otherwise and print warning in to LogCat.
*
* @param obj JSONObject
* @param name name of value
* @return integer
*/
public int getInt(JSONObject obj, String name) {
int result = 0;
try {
result = obj.getInt(name);
} catch (JSONException e) {
Log.w(this, name + " is not exist in this JSON object");
}
return result;
}
示例10: getDouble
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Returns the value mapped by name if it exists and is an double or can be coerced to an double,
* or 0 otherwise and print warning in to LogCat.
*
* @param obj JSONObject
* @param name name of value
* @return double
*/
public double getDouble(JSONObject obj, String name) {
double result = 0;
try {
result = obj.getDouble(name);
} catch (JSONException e) {
Log.w(this, name + " is not exist in this JSON object");
}
return result;
}
示例11: getJSONObject
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Returns the value mapped by name if it exists and is a JSONObject,
* or null otherwise and print warning in to LogCat.
*
* @param obj JSONObject
* @param name name of value
* @return JSONObject
*/
public JSONObject getJSONObject(JSONObject obj, String name) {
JSONObject result = null;
try {
result = obj.getJSONObject(name);
} catch (JSONException e) {
Log.w(this, name + " is not exist in this JSON object");
}
return result;
}
示例12: getJSONArray
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Returns the value mapped by name if it exists and is a JSONArray,
* or null otherwise and print warning in to LogCat.
*
* @param obj JSONArray
* @param name name of value
* @return JSONArray
*/
public JSONArray getJSONArray(JSONObject obj, String name) {
JSONArray result = null;
try {
result = obj.getJSONArray(name);
} catch (JSONException e) {
Log.w(this, name + " is not exist in this JSON object");
}
return result;
}
示例13: fillFromInputStream
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
@Override
public void fillFromInputStream(InputStream in) throws IOException {
if (in == null) {
Log.w("InputStream is null. Parsing aborted.");
return;
}
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
Log.v(line);
}
}
示例14: finishIfTrialExpired
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Check evaluate date and finish activity if expired.
*
* @param activity current activity
* @param year evaluate year
* @param month evaluate month
* @param day evaluate day
*/
@SuppressWarnings("deprecation")
public static void finishIfTrialExpired(Activity activity, int year, int month, int day) {
Date date = new Date();
Date today = new Date();
date.setYear(year - 1900);
date.setMonth(month - 1);
date.setDate(day);
if (date.before(today)) {
Toast.makeText(activity, TRIAL_IS_EXPIRED + date.toGMTString(), Toast.LENGTH_LONG).show();
Log.w(TRIAL_IS_EXPIRED + date.toGMTString());
activity.finish();
}
}
示例15: createDir
import ua.at.tsvetkov.util.Log; //導入方法依賴的package包/類
/**
* Create a dirs in the working dir
*
* @param subDir sub directory
* @return full path
*/
public static String createDir(@NonNull Context context, @NonNull String subDir) {
String path = context.getFilesDir() + subDir;
File dir = new File(path);
if (!dir.exists()) {
boolean result = dir.mkdirs();
if (result) {
Log.i("++ Created the Directory: " + path);
} else {
Log.w("-- Creating the Directory is failed: " + path);
}
return "";
}
return path;
}