本文整理匯總了Java中com.android.volley.VolleyLog.d方法的典型用法代碼示例。如果您正苦於以下問題:Java VolleyLog.d方法的具體用法?Java VolleyLog.d怎麽用?Java VolleyLog.d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.android.volley.VolleyLog
的用法示例。
在下文中一共展示了VolleyLog.d方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeHeader
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Writes the contents of this CacheHeader to the specified OutputStream.
*/
public boolean writeHeader(OutputStream os) {
try {
writeInt(os, CACHE_MAGIC);
writeString(os, key);
writeString(os, etag == null ? "" : etag);
writeLong(os, serverDate);
writeLong(os, lastModified);
writeLong(os, ttl);
writeLong(os, softTtl);
writeStringStringMap(responseHeaders, os);
os.flush();
return true;
} catch (IOException e) {
VolleyLog.d("%s", e.toString());
return false;
}
}
示例2: writeHeader
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Writes the contents of this CacheHeader to the specified OutputStream.
*/
public boolean writeHeader(OutputStream os) {
try {
writeInt(os, CACHE_MAGIC);
writeString(os, key);
writeString(os, etag == null ? "" : etag);
writeLong(os, serverDate);
writeLong(os, ttl);
writeLong(os, softTtl);
writeStringStringMap(responseHeaders, os);
os.flush();
return true;
} catch (IOException e) {
VolleyLog.d("%s", e.toString());
return false;
}
}
示例3: pruneIfNeeded
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Prunes the cache to fit the amount of bytes specified.
* @param neededSpace The amount of bytes we are trying to fit into the cache.
*/
private void pruneIfNeeded(int neededSpace) {
if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes) {
return;
}
if (VolleyLog.DEBUG) {
VolleyLog.v("Pruning old cache entries.");
}
long before = mTotalSize;
int prunedFiles = 0;
long startTime = SystemClock.elapsedRealtime();
Iterator<Map.Entry<String, CacheHeader>> iterator = mEntries.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, CacheHeader> entry = iterator.next();
CacheHeader e = entry.getValue();
boolean deleted = getFileForKey(e.key).delete();
if (deleted) {
mTotalSize -= e.size;
} else {
VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",
e.key, getFilenameForKey(e.key));
}
iterator.remove();
prunedFiles++;
if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
break;
}
}
if (VolleyLog.DEBUG) {
VolleyLog.v("pruned %d files, %d bytes, %d ms",
prunedFiles, (mTotalSize - before), SystemClock.elapsedRealtime() - startTime);
}
}
示例4: clear
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
public synchronized void clear() {
File[] files = this.mRootDirectory.listFiles();
if (files != null) {
for (File file : files) {
file.delete();
}
}
this.mEntries.clear();
this.mTotalSize = 0;
VolleyLog.d("Cache cleared.", new Object[0]);
}
示例5: remove
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Removes the specified key from the cache if it exists.
*/
@Override
public synchronized void remove(String key) {
boolean deleted = getFileForKey(key).delete();
removeEntry(key);
if (!deleted) {
VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",
key, getFilenameForKey(key));
}
}
示例6: logSlowRequests
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Logs requests that took over SLOW_REQUEST_THRESHOLD_MS to complete.
*/
private void logSlowRequests(long requestLifetime, Request<?> request,
byte[] responseContents, StatusLine statusLine) {
if (DEBUG || requestLifetime > SLOW_REQUEST_THRESHOLD_MS) {
VolleyLog.d("HTTP response for request=<%s> [lifetime=%d], [size=%s], " +
"[rc=%d], [retryCount=%s]", request, requestLifetime,
responseContents != null ? responseContents.length : "null",
statusLine.getStatusCode(), request.getRetryPolicy().getCurrentRetryCount());
}
}
示例7: clear
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Clears the cache. Deletes all cached files from disk.
*/
@Override
public synchronized void clear() {
File[] files = mRootDirectory.listFiles();
if (files != null) {
for (File file : files) {
file.delete();
}
}
mEntries.clear();
mTotalSize = 0;
VolleyLog.d("Cache cleared.");
}
示例8: get
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Returns the cache entry with the specified key if it exists, null otherwise.
*/
@Override
public synchronized Entry get(String key) {
CacheHeader entry = mEntries.get(key);
// if the entry does not exist, return.
if (entry == null) {
return null;
}
File file = getFileForKey(key);
CountingInputStream cis = null;
try {
cis = new CountingInputStream(new FileInputStream(file));
CacheHeader.readHeader(cis); // eat header
byte[] data = streamToBytes(cis, (int) (file.length() - cis.bytesRead));
return entry.toCacheEntry(data);
} catch (IOException e) {
VolleyLog.d("%s: %s", file.getAbsolutePath(), e.toString());
remove(key);
return null;
} finally {
if (cis != null) {
try {
cis.close();
} catch (IOException ioe) {
return null;
}
}
}
}
示例9: pruneIfNeeded
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
/**
* Prunes the cache to fit the amount of bytes specified.
* @param neededSpace The amount of bytes we are trying to fit into the cache.
*/
private void pruneIfNeeded(int neededSpace) {
if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes) {
return;
}
if (VolleyLog.DEBUG) {
VolleyLog.v("Pruning old cache entries.");
}
long before = mTotalSize;
int prunedFiles = 0;
long startTime = SystemClock.elapsedRealtime();
Iterator<Map.Entry<String, CacheHeader>> iterator = mEntries.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, CacheHeader> entry = iterator.next();
CacheHeader e = entry.getValue();
boolean deleted = getFileForKey(e.key).delete();
if (deleted) {
mTotalSize -= e.size;
} else {
VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",
e.key, getFilenameForKey(e.key));
}
iterator.remove();
prunedFiles++;
if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
break;
}
}
if (VolleyLog.DEBUG) {
VolleyLog.v("pruned %d files, %d bytes, %d ms",
prunedFiles, (mTotalSize - before), SystemClock.elapsedRealtime() - startTime);
}
}
示例10: onCreate
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
final ProgressDialog pDialog = new ProgressDialog(getActivity());
pDialog.setMessage("Loading...");
pDialog.show();
JsonArrayRequest jsonArrayReq = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG,response.toString());
Log.d(TAG,"Len "+response.length());
mInfoList = JSONinfoParser.parseArrayFeed(response);
pDialog.hide();
MobileAdapter adapter = new MobileAdapter(mInfoList);
setListAdapter(adapter);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
// hide the progress dialog
pDialog.hide();
}
});
// Adding request to request queue
Volley.newRequestQueue(getActivity()).add(jsonArrayReq);
}
示例11: getAPI
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
public void getAPI(){
humansaid = messageET.getText().toString();
jsonURL = "https://monigarr-monigarr-bots-v1.p.mashape.com/conversation_start.php?bot_id=1&say=" +humansaid+ "&format=json";
final ProgressDialog pDialog = new ProgressDialog(ParseJSONObject.this);
pDialog.setMessage("Loading...");
pDialog.show();
JsonObjectRequest jsonObjReq =
new JsonObjectRequest(Method.GET,jsonURL, null,new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
mBotResponse = JSONParser.parseFeed(response);
yousaidTextView.setText("You Said :" + mBotResponse.getYouSaid());
botsaidTextView.setText("Bot Said :" + mBotResponse.getBotSaid());
Log.d(TAG, response.toString());
pDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
pDialog.hide();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("X-Mashape-Key", developerkey);
params.put("Accept", "text/plain");
return params;
}
};
Volley.newRequestQueue(getApplicationContext()).add(jsonObjReq);
}
示例12: validateCertificates
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
@Override
public void validateCertificates(X509Certificate[] serverCertificates) throws CertificateException {
boolean isSelfSigned = false;
boolean isSignedWithCAParent = isSignedWithCAParent(serverCertificates);
try {
isSelfSigned = isSelfSigned(serverCertificates[0]);
} catch (GeneralSecurityException e) {
VolleyLog.d(TAG, "Something is invalid (key signature)");
}
if (isSelfSigned) {
throw new CertificateException("The certificate is self-signed.");
} else if (!isSignedWithCAParent) {
throw new CertificateException("The certificate is not signed with one of his CA's.");
}
}
示例13: sendNotificationPost
import com.android.volley.VolleyLog; //導入方法依賴的package包/類
private void sendNotificationPost(final Map<String, String> data, String url) {
// Instantiate the RequestQueue.
Log.d("d", "Got to sendPost");
RequestQueue requestQueue = Volley.newRequestQueue(this);
Log.d("d", "Data: " + data.toString());
Log.d("d", "Url: " + url);
StringRequest jsonObjRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("volley", "Error: " + error.getMessage());
error.printStackTrace();
}
}) {
@Override
public String getBodyContentType() {
return "application/x-www-form-urlencoded; charset=UTF-8";
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params = data;
return params;
}
};
requestQueue.add(jsonObjRequest);
}