LOG4J2-1274 accept the more general CharSequence instead of only StringBuilder


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4cf5e5bd
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4cf5e5bd
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4cf5e5bd

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 4cf5e5bda29a5755cbccbbb4b8e8a9cd372a2677
Parents: 4b1e3ee
Author: rpopma <[email protected]>
Authored: Sun Feb 21 22:54:33 2016 +0900
Committer: rpopma <[email protected]>
Committed: Sun Feb 21 22:54:33 2016 +0900

----------------------------------------------------------------------
 .../apache/logging/log4j/core/layout/TextEncoderHelper.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4cf5e5bd/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/TextEncoderHelper.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/TextEncoderHelper.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/TextEncoderHelper.java
index 3b81dd8..c8533d7 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/TextEncoderHelper.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/TextEncoderHelper.java
@@ -48,7 +48,7 @@ public class TextEncoderHelper {
         this.cachedCharBuffer = CharBuffer.wrap(new char[bufferSize]);
     }
 
-    public void encodeText(final StringBuilder text, final 
ByteBufferDestination destination) {
+    public void encodeText(final CharSequence text, final 
ByteBufferDestination destination) {
         charsetEncoder.reset();
         ByteBuffer byteBuf = destination.getByteBuffer();
         final CharBuffer charBuf = getCachedCharBuffer();
@@ -116,13 +116,13 @@ public class TextEncoderHelper {
     }
 
     /**
-     * Copies characters from the StringBuilder into the CharBuffer,
+     * Copies characters from the CharSequence into the CharBuffer,
      * starting at the specified offset and ending when either all
      * characters have been copied or when the CharBuffer is full.
      *
      * @return the number of characters that were copied
      */
-    static int copy(final StringBuilder source, final int offset, final 
CharBuffer destination) {
+    static int copy(final CharSequence source, final int offset, final 
CharBuffer destination) {
         final int length = Math.min(source.length() - offset, 
destination.remaining());
         for (int i = offset; i < offset + length; i++) {
             destination.put(source.charAt(i));

Reply via email to