You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/01/08 14:41:15 UTC

(httpcomponents-client) 04/04: Added #toString methods to Resource implementations

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch cache_control_api
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit e4d670c108b59b5efa66cb1c4c297b3a5f02ca70
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Jan 4 09:28:53 2024 +0100

    Added #toString methods to Resource implementations
---
 .../java/org/apache/hc/client5/http/impl/cache/FileResource.java  | 8 ++++++++
 .../java/org/apache/hc/client5/http/impl/cache/HeapResource.java  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResource.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResource.java
index 69ed1a412..4636bdaf3 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResource.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResource.java
@@ -109,4 +109,12 @@ public class FileResource extends Resource {
         }
     }
 
+    @Override
+    public String toString() {
+        return "[" +
+                "file=" + getFile() + "," +
+                "len=" + length() +
+                ']';
+    }
+
 }
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResource.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResource.java
index 8a23e3916..a632f5266 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResource.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResource.java
@@ -74,4 +74,12 @@ public class HeapResource extends Resource {
         this.arrayRef.set(null);
     }
 
+    @Override
+    public String toString() {
+        return "[" +
+                "heap," +
+                "len=" + length() +
+                ']';
+    }
+
 }