本文整理汇总了Java中ua.at.tsvetkov.util.Log.e方法的典型用法代码示例。如果您正苦于以下问题:Java Log.e方法的具体用法?Java Log.e怎么用?Java Log.e使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ua.at.tsvetkov.util.Log
的用法示例。
在下文中一共展示了Log.e方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: fromInputStream
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Computes and returns the final hash value for this InputStream data
*
* @param in InputStream
* @return null if has error or hash value
*/
public static byte[] fromInputStream(InputStream in) {
MessageDigest digester;
try {
digester = MessageDigest.getInstance("MD5");
byte[] bytes = new byte[8192];
int byteCount;
while ((byteCount = in.read(bytes)) > 0) {
digester.update(bytes, 0, byteCount);
}
return digester.digest();
} catch (Exception e) {
Log.e(e);
}
return null;
}
示例3: deleteDir
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Delete directory with a subdirs and a files
*
* @param dir directory for delete
* @return tue if success
*/
public static boolean deleteDir(File dir) {
if (dir == null) {
Log.e("Directory eq null - can't delete.");
return false;
}
if (dir.isDirectory()) {
String[] children = dir.list();
for (String element : children) {
boolean success = deleteDir(new File(dir, element));
if (!success) {
return false;
}
}
}
return dir.delete();
}
示例4: getFileLength
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Returns the content length in bytes specified by the response header field content-length or -1 if this field is not set.
*
* @param url url path to file
* @return the value of the response header field content-length
*/
static public int getFileLength(String url) {
HttpURLConnection conn = null;
int length = 0;
try {
conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestProperty("keep-alive", "false");
conn.setDoInput(true);
conn.setConnectTimeout(TIMEOUT);
conn.connect();
length = conn.getContentLength();
} catch (Exception e) {
Log.e(e);
} finally {
if (conn != null)
conn.disconnect();
}
return length;
}
示例5: getStatusCode
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
@Override
public int getStatusCode() {
try {
statusCode = httpURLConnection.getResponseCode();
} catch (IOException e) {
Log.e("IO error during the retrieval response code.", e);
statusCode = ConnectionConstants.NO_INTERNET_CONNECTION;
}
return statusCode;
}
示例6: getStatusMessage
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
@Override
public String getStatusMessage() {
String message = "";
try {
message = httpURLConnection.getResponseMessage();
} catch (IOException e) {
Log.e("IO error during the retrieval response message.", e);
message = "No internet connection.";
}
return message;
}
示例7: getURL
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Generate URL
*
* @return URL
*/
public URL getURL() {
try {
return new URL(toString());
} catch (MalformedURLException e) {
Log.e(WRONG_URL, e);
return null;
}
}
示例8: getApplicationSignatureKeyHash
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Return the KeyHash for the application
*
* @param context the application Context
* @param packageName a package name
*/
public static String getApplicationSignatureKeyHash(Context context, String packageName) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
return Base64.encodeToString(md.digest(), Base64.DEFAULT);
}
} catch (Exception e) {
Log.e(e);
}
return "";
}
示例9: fromFile
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Computes and returns the final hash value for file data
*
* @param fileName path to file
* @return null if has error or hash value
*/
public static byte[] fromFile(String fileName) {
try {
InputStream in = new FileInputStream(fileName);
return fromInputStream(in);
} catch (FileNotFoundException e) {
Log.e(e);
}
return null;
}
示例10: copy
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Copy file from source to destination
*
* @param srcFileName source file name
* @param dstFile destination file
* @return true if success
*/
public static boolean copy(@NonNull String srcFileName, @NonNull File dstFile) {
if (srcFileName == null || srcFileName.length() == 0) {
Log.e("Source file name is empty.");
return false;
}
if (dstFile == null) {
Log.e("Destination file is null.");
return false;
}
return copy(srcFileName, dstFile.getAbsoluteFile());
}
示例11: copyAsset
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Copy file from assets source to destination
*
* @param context base app context
* @param assetsFileName assets file name
* @param dstFile destination of copy
* @return true if success
*/
public static boolean copyAsset(@NonNull Context context, @NonNull String assetsFileName, @NonNull File dstFile) {
if (assetsFileName == null || assetsFileName.length() == 0) {
Log.e("Assets file name is empty.");
return false;
}
if (dstFile == null) {
Log.e("Destination file is null.");
return false;
}
return copyAsset(context, assetsFileName, dstFile.getAbsolutePath());
}
示例12: getFileNameNoExtension
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Return file name without extension
*
* @param path full path to file
* @return file name without extension
*/
public static String getFileNameNoExtension(String path) {
String name = "";
try {
int pos = path.lastIndexOf(File.separator) + 1;
int dotPos = path.lastIndexOf(".") + 1;
name = path.substring(pos, dotPos);
} catch (Exception e) {
Log.e(e);
}
return name;
}
示例13: onFinish
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
@Override
public void onFinish(MonarchArray items, int what) {
acMainProgressLayout.setVisibility(View.GONE);
if (what == HttpStatus.SC_OK) {
adapter.init(items);
Log.i("MONARCH LOADED");
} else {
Log.e("Error, What=" + what);
}
}
示例14: init
import ua.at.tsvetkov.util.Log; //导入方法依赖的package包/类
/**
* Init configuration.
*
* @param application the Application
* @throws NumberFormatException
*/
public static void init(Application application) {
mPackageName = application.getApplicationInfo().packageName;
PackageInfo appData = null;
try {
appData = application.getPackageManager().getPackageInfo(application.getPackageName(), PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
Log.e("Package not found", e);
}
mPreferences = PreferenceManager.getDefaultSharedPreferences(application);
mEditor = mPreferences.edit();
mAppName = application.getString(appData.applicationInfo.labelRes);
isNewApplication = (mPreferences.getInt(APP_VERSION_CODE, -1) < 0);
if (appData.versionCode > mPreferences.getInt(APP_VERSION_CODE, 0)) {
isNewVersion = true;
}
PointF pf = Screen.getSizeInInch(application);
double diag = Math.sqrt(pf.x * pf.x + pf.y * pf.y);
if (diag < 6) {
mDiagonal = Diagonal.PHONE;
} else if (diag >= 6 && diag < 8) {
mDiagonal = Diagonal.TABLET_7;
} else if (diag >= 8 && diag < 11) {
mDiagonal = Diagonal.TABLET_10;
} else {
mDiagonal = Diagonal.TABLET_BIG;
}
mAppSignatureKeyHash = Apps.getApplicationSignatureKeyHash(application, mPackageName);
mAppSignatureFingerprint = Apps.getSignatureFingerprint(application, mPackageName);
mAppVersionName = appData.versionName;
mAppVersionCode = appData.versionCode;
mAndroidId = Settings.Secure.getString(application.getContentResolver(), Settings.Secure.ANDROID_ID);
mEditor.putString(ANDROID_ID, mAndroidId);
mEditor.putString(APP_NAME, mAppName);
mEditor.putString(APP_VERSION_NAME, mAppVersionName);
mEditor.putString(APP_PACKAGE_NAME, mPackageName);
mEditor.putInt(APP_VERSION_CODE, mAppVersionCode);
mEditor.putBoolean(NEW_VERSION, isNewVersion);
mEditor.putBoolean(NEW_INSTALL, isNewApplication);
save();
isDebuggable = (0 != (application.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
isBeingDebugged = android.os.Debug.isDebuggerConnected();
if (isDebuggable) {
android.util.Log.i(DIV_LEFT + mAppName + DIV_RIGHT, "➧ Log enabled.");
} else {
android.util.Log.w(DIV_LEFT + mAppName + DIV_RIGHT, "➧ Log is prohibited because debug mode is disabled.");
Log.setDisabled(true);
}
AppResources.init(application);
isInitialized = true;
}