You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/02/21 04:36:28 UTC
[3/5] logging-log4j2 git commit: LOG4J2-1274 add Encoder interface
LOG4J2-1274 add Encoder interface
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2da09ab0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2da09ab0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2da09ab0
Branch: refs/heads/master
Commit: 2da09ab057147966556845e542e79f211a76ba4e
Parents: 8ad0913
Author: rpopma <rp...@apache.org>
Authored: Sun Feb 21 12:18:01 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Feb 21 12:18:01 2016 +0900
----------------------------------------------------------------------
.../logging/log4j/core/layout/Encoder.java | 36 ++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2da09ab0/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Encoder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Encoder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Encoder.java
new file mode 100644
index 0000000..11e0e83
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Encoder.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.layout;
+
+/**
+ * Objects implementing the {@code Encoder} interface know how to convert an object to some binary representation and
+ * write the result to a {@code ByteBuffer}, ideally without creating temporary objects.
+ *
+ * @param <T> the type of objects that the Encoder can encode
+ * @since 2.6
+ */
+public interface Encoder<T> {
+
+ /**
+ * Encodes the specified source object to some binary representation and writes the result to the specified
+ * destination.
+ *
+ * @param source the object to encode.
+ * @param destination holds the ByteBuffer to write into.
+ */
+ void encode(T source, ByteBufferDestination destination);
+}