[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, encoder, updated. v0.9.18-34-gade0073

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Sun Feb 21 00:33:28 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, encoder has been updated
       via  ade00738d1df9cf6d56d3fb98ca28c5977e688d6 (commit)
      from  6a3e7041abd4d363afa4b8dd53a132f1f624a65c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=ade00738d1df9cf6d56d3fb98ca28c5977e688d6
http://github.com/ceki/logback/commit/ade00738d1df9cf6d56d3fb98ca28c5977e688d6

commit ade00738d1df9cf6d56d3fb98ca28c5977e688d6
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Sun Feb 21 00:28:24 2010 +0100

    - Added an example of a sample object encoder called
    ObjectStreamEncoder and a corresponding InputStream called
    EventObjectInputStream.

diff --git a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
index 74cfd1b..637a1b4 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
@@ -112,4 +112,7 @@ public class CoreConstants {
    * context.
    */
   public static final String HOSTNAME_KEY = "HOSTNAME";
+  
+  
+  public static int BYTES_PER_INT = 4;
 }
diff --git a/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java b/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
index 9dd0eaf..df991d7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
@@ -17,6 +17,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 
+import ch.qos.logback.core.encoder.Encoder;
 import ch.qos.logback.core.spi.DeferredProcessingAware;
 import ch.qos.logback.core.status.ErrorStatus;
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
new file mode 100644
index 0000000..e0f1181
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
@@ -0,0 +1,56 @@
+package ch.qos.logback.core.encoder;
+
+import java.io.ByteArrayOutputStream;
+
+public class ByteArrayUtil {
+
+  // big-endian
+  static void writeInt(byte[] byteArray, int offset, int i) {
+    for (int j = 0; j < 4; j++) {
+      int shift = 24 - j * 8;
+      byteArray[offset + j] = (byte) (i >>> shift);
+    }
+  }
+
+  static void writeInt(ByteArrayOutputStream baos, int i) {
+    for (int j = 0; j < 4; j++) {
+      int shift = 24 - j * 8;
+      baos.write((byte) (i >>> shift));
+    }
+  }
+  
+  // big-endian  
+  static int readInt(byte[] byteArray, int offset) {
+    int i = 0;
+    for (int j = 0; j < 4; j++) {
+      int shift = 24 - j * 8;
+      i += (byteArray[offset + j] & 0xFF) << shift;
+    }
+    return i;
+  }
+  
+  static public String toHexString(byte[] ba) {
+    StringBuffer sbuf = new StringBuffer();
+    for(byte b: ba) {
+      String s = Integer.toHexString( (int)(b & 0xff));
+      if(s.length() == 1) {
+        sbuf.append('0');
+      }
+      sbuf.append(s);
+    }
+    return sbuf.toString();
+  }
+
+  static public byte[] hexStringToByteArray(String s) {
+    int len = s.length();
+    byte[] ba = new byte[len/2];
+
+    for(int i = 0; i < ba.length; i++) {
+      int j = i*2;
+      int t = Integer.parseInt(s.substring(j, j+2), 16);
+      byte b = (byte) (t & 0xFF);
+      ba[i] = b;
+    }
+    return ba;
+  }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Encoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
similarity index 95%
copy from logback-core/src/main/java/ch/qos/logback/core/Encoder.java
copy to logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
index 1734e4a..18219be 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Encoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
@@ -11,7 +11,7 @@
  * under the terms of the GNU Lesser General Public License version 2.1
  * as published by the Free Software Foundation.
  */
-package ch.qos.logback.core;
+package ch.qos.logback.core.encoder;
 
 import java.io.IOException;
 import java.io.OutputStream;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
index ac5febf..aaab297 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
@@ -3,7 +3,6 @@ package ch.qos.logback.core.encoder;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import ch.qos.logback.core.Encoder;
 import ch.qos.logback.core.spi.ContextAwareBase;
 
 abstract public class EncoderBase<E> extends ContextAwareBase implements Encoder<E> {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
new file mode 100644
index 0000000..0d9726f
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
@@ -0,0 +1,160 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ *   or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.encoder;
+
+import static ch.qos.logback.core.CoreConstants.BYTES_PER_INT;
+import static ch.qos.logback.core.encoder.ObjectStreamEncoder.START_PEBBLE;
+import static ch.qos.logback.core.encoder.ObjectStreamEncoder.STOP_PEBBLE;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Restitute the contents of an input stream as java objects.
+ * 
+ * @author Ceki G&uuml;lc&uuml;
+ *
+ * @param <E>
+ */
+public class EventObjectInputStream<E> extends InputStream {
+
+  NonClosableInputStream ncis;
+  List<E> buffer = new ArrayList<E>();
+
+  int index = 0;
+
+  EventObjectInputStream(InputStream is) throws IOException {
+    this.ncis = new NonClosableInputStream(is);
+  }
+
+  @Override
+  public int read() throws IOException {
+    throw new UnsupportedOperationException(
+        "Only the readEvent method is supported.");
+  }
+
+  /**
+   * Returns the number of bytes available
+   */
+  public int available() throws IOException {
+    return ncis.available();
+  }
+
+  public E readEvent() throws IOException {
+
+    E event = getFromBuffer();
+    if (event != null) {
+      return event;
+    }
+
+    internalReset();
+    int count = readHeader();
+    if(count == -1) {
+      return null;
+    }
+    readPayload(count);
+    readFooter(count);
+    return getFromBuffer();
+  }
+
+  private void  internalReset() {
+    index = 0;
+    buffer.clear();
+  }
+  
+  E getFromBuffer() {
+    if (index >= buffer.size()) {
+      return null;
+    }
+    return buffer.get(this.index++);
+  }
+
+  int readHeader() throws IOException {
+    byte[] headerBA = new byte[4 * BYTES_PER_INT];
+    System.out.println("available="+ncis.available());
+    int bytesRead = ncis.read(headerBA);
+    if(bytesRead == -1) {
+      return -1;
+    }
+    System.out.println("**bytesRead="+bytesRead);
+    
+    System.out.println(ByteArrayUtil.toHexString(headerBA));
+    
+    int offset = 0;
+    int startPebble = ByteArrayUtil.readInt(headerBA, offset);
+    if (startPebble != START_PEBBLE) {
+      throw new IllegalStateException(
+          "Does not look like data created by ObjectStreamEncoder");
+    }
+    offset += BYTES_PER_INT;
+    int count = ByteArrayUtil.readInt(headerBA, offset);
+    offset += BYTES_PER_INT;
+    int endPointer = ByteArrayUtil.readInt(headerBA, offset);
+    offset += BYTES_PER_INT;
+    int checksum = ByteArrayUtil.readInt(headerBA, offset);
+    if (checksum != (START_PEBBLE ^ count)) {
+      throw new IllegalStateException("Invalid checksum");
+    }
+    return count;
+  }
+
+  @SuppressWarnings("unchecked")
+  E readEvents(ObjectInputStream ois) throws IOException {
+    E e = null;
+    try {
+      e = (E) ois.readObject();
+      buffer.add(e);
+      System.out.println("Read in event: "+e);
+    } catch (ClassNotFoundException e1) {
+      // FIXME Auto-generated catch block
+      e1.printStackTrace();
+    }
+    return e;
+  }
+
+  void readFooter(int count) throws IOException {
+    byte[] headerBA = new byte[2 * BYTES_PER_INT];
+    ncis.read(headerBA);
+    
+    int offset = 0;
+    int stopPebble = ByteArrayUtil.readInt(headerBA, offset);
+    if (stopPebble != STOP_PEBBLE) {
+      throw new IllegalStateException(
+          "Looks like a corrupt stream");
+    }
+    offset += BYTES_PER_INT;
+    int checksum = ByteArrayUtil.readInt(headerBA, offset);
+    if (checksum != (STOP_PEBBLE ^ count)) {
+      throw new IllegalStateException("Invalid checksum");
+    }
+  }
+  
+  void readPayload(int count) throws IOException {
+    List<E> eventList = new ArrayList<E>(count);
+    ObjectInputStream ois = new ObjectInputStream(ncis);
+    for (int i = 0; i < count; i++) {
+      E e = (E) readEvents(ois);
+      eventList.add(e);
+    }
+    ois.close();
+  }
+
+  public void close() throws IOException {
+    ncis.realClose();
+  }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
new file mode 100644
index 0000000..716339b
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
@@ -0,0 +1,25 @@
+package ch.qos.logback.core.encoder;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class NonClosableInputStream extends FilterInputStream {
+
+  NonClosableInputStream(InputStream is) {
+    super(is);
+  }
+
+  /**
+   * The whole point of this input stream is to ignore invocations to close()
+   */
+  @Override
+  public void close() {
+
+  }
+
+  public void realClose() throws IOException {
+    super.close();
+  }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
new file mode 100644
index 0000000..036e498
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
@@ -0,0 +1,95 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ * 
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ * 
+ * or (per the licensee's choosing)
+ * 
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.encoder;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.qos.logback.core.CoreConstants;
+
+/**
+ * Write out events as java objects.
+ * 
+ * @author Ceki G&uuml;lc&uuml;
+ *
+ * @param <E>
+ */
+public class ObjectStreamEncoder<E> extends EncoderBase<E> {
+
+  static public int START_PEBBLE = 1853421169;
+  //static public int START_PEBBLE = 1;
+  
+  static public int STOP_PEBBLE = 640373619;
+
+  private int MAX_BUFFER_SIZE = 100;
+
+  List<E> bufferList = new ArrayList<E>(MAX_BUFFER_SIZE);
+
+  public void doEncode(E event) throws IOException {
+    bufferList.add(event);
+    if (bufferList.size() == MAX_BUFFER_SIZE) {
+      writeBuffer();
+    }
+  }
+
+  void writeHeader(ByteArrayOutputStream baos, int bufferSize) {
+    ByteArrayUtil.writeInt(baos, START_PEBBLE);
+    ByteArrayUtil.writeInt(baos, bufferSize);
+    ByteArrayUtil.writeInt(baos, 0);
+    ByteArrayUtil.writeInt(baos, START_PEBBLE^bufferSize);
+  }
+  
+  void writeFooter(ByteArrayOutputStream baos, int bufferSize) {
+    ByteArrayUtil.writeInt(baos, STOP_PEBBLE);
+    ByteArrayUtil.writeInt(baos, STOP_PEBBLE ^ bufferSize);
+  }
+  void writeBuffer() throws IOException {
+    ByteArrayOutputStream baos = new ByteArrayOutputStream(10000);
+    
+    int size = bufferList.size();
+    writeHeader(baos, size);
+    ObjectOutputStream oos = new ObjectOutputStream(baos);
+    for (E e : bufferList) {
+      oos.writeObject(e);
+    }
+    bufferList.clear();
+    oos.flush();
+
+    writeFooter(baos, size);
+
+    byte[] byteArray = baos.toByteArray();
+    oos.close();
+    writeEndPosition(byteArray);
+    outputStream.write(byteArray);
+    
+  }
+  
+  void writeEndPosition(byte[] byteArray) {
+    int offset = 2*CoreConstants.BYTES_PER_INT;
+    ByteArrayUtil.writeInt(byteArray,offset, byteArray.length-offset);
+  }
+  
+  public void init(OutputStream os) throws IOException {
+    super.init(os);
+    bufferList.clear();
+  }
+
+  public void close() throws IOException {
+    writeBuffer();
+  }
+}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java b/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java
index a3af565..d4eca59 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java
@@ -27,7 +27,8 @@ import org.junit.runners.Suite.SuiteClasses;
   ch.qos.logback.core.appender.PackageTest.class,
   ch.qos.logback.core.spi.PackageTest.class,
   ch.qos.logback.core.rolling.PackageTest.class,
-  ch.qos.logback.core.sift.PackageTest.class})
+  ch.qos.logback.core.sift.PackageTest.class, 
+  ch.qos.logback.core.encoder.PackageTest.class})
 public class AllCoreTest {
 
 }
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/DummyAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/DummyAppenderTest.java
index 6443b0a..0566170 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/DummyAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/DummyAppenderTest.java
@@ -21,8 +21,8 @@ import java.io.IOException;
 import org.junit.Test;
 
 import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.Encoder;
 import ch.qos.logback.core.encoder.DummyEncoder;
+import ch.qos.logback.core.encoder.Encoder;
 import ch.qos.logback.core.layout.DummyLayout;
 
 
diff --git a/logback-core/src/test/java/ch/qos/logback/core/encoder/ByteArrayUtilTest.java b/logback-core/src/test/java/ch/qos/logback/core/encoder/ByteArrayUtilTest.java
new file mode 100644
index 0000000..9dd50aa
--- /dev/null
+++ b/logback-core/src/test/java/ch/qos/logback/core/encoder/ByteArrayUtilTest.java
@@ -0,0 +1,53 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ * 
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ * 
+ * or (per the licensee's choosing)
+ * 
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.encoder;
+
+import static org.junit.Assert.*;
+
+import java.util.Random;
+
+import org.junit.Test;
+
+public class ByteArrayUtilTest {
+
+  int BA_SIZE = 16;
+  byte[] byteArray = new byte[BA_SIZE];
+
+  Random random = new Random(18532235);
+  
+  @Test
+  public void smoke() {
+    verifyLoop(byteArray, 0, 0);
+    verifyLoop(byteArray, 0, 10);
+    verifyLoop(byteArray, 0, Integer.MAX_VALUE);
+    verifyLoop(byteArray, 0, Integer.MIN_VALUE);
+  }
+
+  @Test
+  public void random() {
+    for(int i = 0; i < 100000; i++) {
+      int rOffset = random.nextInt(BA_SIZE-4);
+      int rInt = random.nextInt();
+      verifyLoop(byteArray, rOffset, rInt);
+    }
+  }
+  
+  void verifyLoop(byte[] ba, int offset, int expected) {
+    ByteArrayUtil.writeInt(byteArray, offset, expected);
+    int back = ByteArrayUtil.readInt(byteArray, offset);
+    assertEquals(expected, back);
+    
+  }
+
+}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/encoder/ObjectEncodeDecodeTest.java b/logback-core/src/test/java/ch/qos/logback/core/encoder/ObjectEncodeDecodeTest.java
new file mode 100644
index 0000000..2f43dae
--- /dev/null
+++ b/logback-core/src/test/java/ch/qos/logback/core/encoder/ObjectEncodeDecodeTest.java
@@ -0,0 +1,82 @@
+package ch.qos.logback.core.encoder;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import ch.qos.logback.core.testUtil.RandomUtil;
+import ch.qos.logback.core.util.CoreTestConstants;
+
+public class ObjectEncodeDecodeTest {
+
+  ObjectStreamEncoder<String> encoder = new ObjectStreamEncoder<String>();
+  EventObjectInputStream<String> eventStream;
+
+  int diff = RandomUtil.getPositiveInt();
+  protected String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff
+      + "/";
+
+  @Before
+  public void setUp() {
+    File randomOupurDirFile = new File(randomOutputDir);
+    randomOupurDirFile.mkdirs();
+  }
+
+  void encodeList(File file, List<String> list) throws IOException {
+    FileOutputStream fos = new FileOutputStream(file);
+    encoder.init(fos);
+    for (String s: list) {
+      encoder.doEncode(s);
+    }
+    encoder.close();
+    fos.close();
+  }
+  
+  
+  List<String> decodeList(File file) throws IOException {
+    FileInputStream fis = new FileInputStream(file);
+    eventStream = new EventObjectInputStream<String>(fis);
+    List<String> back = new ArrayList<String>();
+    String e;
+    while((e=eventStream.readEvent()) != null) {
+      back.add(e);
+    }
+    return back;
+  }
+
+  @Test
+  public void singleBatch() throws IOException {
+    File file = new File(randomOutputDir + "x.lbo");
+
+    List<String> witness = new ArrayList<String>();
+    for (int i = 0; i < 10; i++) {
+      witness.add("hello" + i);
+    }
+    encodeList(file, witness);
+    List<String> back = decodeList(file);
+    assertEquals(witness, back);
+  }
+
+  @Test
+  public void multipleBatches() throws IOException {
+    File file = new File(randomOutputDir + "m.lbo");
+
+    List<String> witness = new ArrayList<String>();
+    for (int i = 0; i < 100*10; i++) {
+      witness.add("hello" + i);
+    }
+    encodeList(file, witness);
+    List<String> back = decodeList(file);
+    assertEquals(witness, back);
+  }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Encoder.java b/logback-core/src/test/java/ch/qos/logback/core/encoder/PackageTest.java
similarity index 56%
rename from logback-core/src/main/java/ch/qos/logback/core/Encoder.java
rename to logback-core/src/test/java/ch/qos/logback/core/encoder/PackageTest.java
index 1734e4a..f49d572 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Encoder.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/encoder/PackageTest.java
@@ -11,18 +11,12 @@
  * under the terms of the GNU Lesser General Public License version 2.1
  * as published by the Free Software Foundation.
  */
-package ch.qos.logback.core;
+package ch.qos.logback.core.encoder;
 
-import java.io.IOException;
-import java.io.OutputStream;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
-import ch.qos.logback.core.spi.ContextAware;
-import ch.qos.logback.core.spi.LifeCycle;
-
-public interface Encoder<E> extends ContextAware, LifeCycle {
-  
-  void doEncode(E event) throws IOException;
-  void init(OutputStream os) throws IOException;
-  void close() throws IOException;
-  
+ at RunWith(Suite.class)
+ at Suite.SuiteClasses( { ByteArrayUtilTest.class, ObjectEncodeDecodeTest.class })
+public class PackageTest {
 }
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
index 3a1d898..ba31085 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
@@ -30,10 +30,10 @@ import org.junit.Test;
 
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.Encoder;
 import ch.qos.logback.core.contention.MultiThreadedHarness;
 import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
 import ch.qos.logback.core.encoder.EchoEncoder;
+import ch.qos.logback.core.encoder.Encoder;
 import ch.qos.logback.core.status.StatusChecker;
 import ch.qos.logback.core.testUtil.Env;
 import ch.qos.logback.core.testUtil.RandomUtil;
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
index b08df19..b1e43e1 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
@@ -24,8 +24,8 @@ import org.junit.Test;
 
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.Encoder;
 import ch.qos.logback.core.encoder.EchoEncoder;
+import ch.qos.logback.core.encoder.Encoder;
 import ch.qos.logback.core.util.Compare;
 import ch.qos.logback.core.util.CoreTestConstants;
 

-----------------------------------------------------------------------

Summary of changes:
 .../java/ch/qos/logback/core/CoreConstants.java    |    3 +
 .../java/ch/qos/logback/core/WriterAppender.java   |    1 +
 .../ch/qos/logback/core/encoder/ByteArrayUtil.java |   56 +++++++
 .../ch/qos/logback/core/{ => encoder}/Encoder.java |    2 +-
 .../ch/qos/logback/core/encoder/EncoderBase.java   |    1 -
 .../core/encoder/EventObjectInputStream.java       |  160 ++++++++++++++++++++
 .../core/encoder/NonClosableInputStream.java       |   25 +++
 .../logback/core/encoder/ObjectStreamEncoder.java  |   95 ++++++++++++
 .../test/java/ch/qos/logback/core/AllCoreTest.java |    3 +-
 .../logback/core/appender/DummyAppenderTest.java   |    2 +-
 .../logback/core/encoder/ByteArrayUtilTest.java    |   53 +++++++
 .../core/encoder/ObjectEncodeDecodeTest.java       |   82 ++++++++++
 .../ch/qos/logback/core/encoder}/PackageTest.java  |    7 +-
 .../core/rolling/MultiThreadedRollingTest.java     |    2 +-
 .../ch/qos/logback/core/rolling/RenamingTest.java  |    2 +-
 15 files changed, 484 insertions(+), 10 deletions(-)
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
 rename logback-core/src/main/java/ch/qos/logback/core/{ => encoder}/Encoder.java (95%)
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
 create mode 100644 logback-core/src/test/java/ch/qos/logback/core/encoder/ByteArrayUtilTest.java
 create mode 100644 logback-core/src/test/java/ch/qos/logback/core/encoder/ObjectEncodeDecodeTest.java
 copy {logback-classic/src/test/java/ch/qos/logback/classic/html => logback-core/src/test/java/ch/qos/logback/core/encoder}/PackageTest.java (83%)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list