directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r123317 - in incubator/directory/network/trunk/mina/src: examples/org/apache/mina/examples/echoserver examples/org/apache/mina/examples/netcat examples/org/apache/mina/examples/reverser java/org/apache/mina/common java/org/apache/mina/io java/org/apache/mina/io/datagram java/org/apache/mina/io/filter java/org/apache/mina/io/socket java/org/apache/mina/protocol java/org/apache/mina/util
Date Sat, 25 Dec 2004 06:08:03 GMT
Author: trustin
Date: Fri Dec 24 22:08:01 2004
New Revision: 123317

URL: http://svn.apache.org/viewcvs?view=rev&rev=123317
Log:
 * Replaced java.nio.ByteBuffer to mina.common.ByteBuffer for safe buffer pooling.
 * Moved ByteBufferPool to common package.
Added:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBuffer.java
  (contents, props changed)
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBufferPool.java
      - copied, changed from r123314, incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java
Removed:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java
Modified:
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
Fri Dec 24 22:08:01 2004
@@ -18,12 +18,12 @@
  */
 package org.apache.mina.examples.echoserver;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.util.ByteBufferPool;
 
 /**
  * TODO Document me.

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.examples.netcat;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandlerAdapter;

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.examples.reverser;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 import org.apache.mina.protocol.ProtocolDecoder;
 import org.apache.mina.protocol.ProtocolDecoderOutput;

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
Fri Dec 24 22:08:01 2004
@@ -18,13 +18,13 @@
  */
 package org.apache.mina.examples.reverser;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.protocol.ProtocolEncoder;
 import org.apache.mina.protocol.ProtocolEncoderOutput;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
-import org.apache.mina.util.ByteBufferPool;
 
 /**
  * TODO Document me.

Added: incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBuffer.java?view=auto&rev=123317
==============================================================================
--- (empty file)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBuffer.java
Fri Dec 24 22:08:01 2004
@@ -0,0 +1,317 @@
+/*
+ * @(#) $Id$
+ */
+package org.apache.mina.common;
+
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+/**
+ * A byte buffer used by MINA applications.
+ * <p>
+ * This is a replacement for {@link java.nio.ByteBuffer}. Please see
+ * {@link java.nio.ByteBuffer} documentation for usage.
+ * 
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$,
+ */
+public final class ByteBuffer {
+	private final java.nio.ByteBuffer buf;
+
+	ByteBuffer(java.nio.ByteBuffer buf) {
+		this.buf = buf;
+	}
+	
+	/**
+	 * Returns the underlying NIO buffer instance.
+	 */
+	public java.nio.ByteBuffer buf() {
+		return buf;
+	}
+
+	public int capacity() {
+		return buf.capacity();
+	}
+
+	public int position() {
+		return buf.position();
+	}
+
+	public ByteBuffer position(int newPosition) {
+		buf.position(newPosition);
+		return this;
+	}
+
+	public int limit() {
+		return buf.limit();
+	}
+
+	public ByteBuffer limit(int newLimit) {
+		buf.limit(newLimit);
+		return this;
+	}
+
+	public ByteBuffer mark() {
+		buf.mark();
+		return this;
+	}
+
+	public ByteBuffer reset() {
+		buf.reset();
+		return this;
+	}
+
+	public ByteBuffer clear() {
+		buf.clear();
+		return this;
+	}
+
+	public ByteBuffer flip() {
+		buf.flip();
+		return this;
+	}
+
+	public ByteBuffer rewind() {
+		buf.rewind();
+		return this;
+	}
+
+	public int remaining() {
+		return buf.remaining();
+	}
+
+	public boolean hasRemaining() {
+		return buf.hasRemaining();
+	}
+
+    public java.nio.ByteBuffer slice() {
+    	return buf.slice();
+    }
+
+    public java.nio.ByteBuffer duplicate() {
+    	return buf.duplicate();
+    }
+
+    public java.nio.ByteBuffer asReadOnlyBuffer() {
+    	return buf.asReadOnlyBuffer();
+    }
+
+    public byte get() {
+    	return buf.get();
+    }
+
+    public ByteBuffer put(byte b) {
+    	buf.put(b);
+    	return this;
+    }
+
+    public byte get(int index) {
+    	return buf.get(index);
+    }
+
+    public ByteBuffer put(int index, byte b) {
+    	buf.put(index, b);
+    	return this;
+    }
+
+    public ByteBuffer get(byte[] dst, int offset, int length) {
+    	buf.get(dst, offset, length);
+    	return this;
+    }
+
+    public ByteBuffer get(byte[] dst) {
+    	buf.get(dst);
+    	return this;
+    }
+
+    public ByteBuffer put(java.nio.ByteBuffer src) {
+    	buf.put(src);
+    	return this;
+    }
+    
+    public ByteBuffer put(ByteBuffer src) {
+    	buf.put(src.buf());
+    	return this;
+    }
+
+    public ByteBuffer put(byte[] src, int offset, int length) {
+    	buf.put(src, offset, length);
+    	return this;
+    }
+
+    public ByteBuffer put(byte[] src) {
+    	buf.put(src);
+    	return this;
+    }
+
+    public ByteBuffer compact() {
+    	buf.compact();
+    	return this;
+    }
+
+    public String toString() {
+    	return buf.toString();
+    }
+
+    public int hashCode() {
+    	return buf.hashCode();
+    }
+
+    public boolean equals(Object ob) {
+		if (!(ob instanceof ByteBuffer))
+		    return false;
+
+		ByteBuffer that = (ByteBuffer)ob;
+		return this.buf.equals(that.buf);
+    }
+
+    public int compareTo(ByteBuffer that) {
+    	return this.buf.compareTo(that.buf);
+    }
+
+    public ByteOrder order() {
+    	return buf.order();
+    }
+
+    public ByteBuffer order(ByteOrder bo) {
+    	buf.order(bo);
+    	return this;
+    }
+
+    public char getChar() {
+    	return buf.getChar();
+    }
+
+    public ByteBuffer putChar(char value) {
+    	buf.putChar(value);
+    	return this;
+    }
+
+    public char getChar(int index) {
+    	return buf.getChar(index);
+    }
+
+    public ByteBuffer putChar(int index, char value) {
+    	buf.putChar(index, value);
+    	return this;
+    }
+
+    public CharBuffer asCharBuffer() {
+    	return buf.asCharBuffer();
+    }
+
+    public short getShort() {
+    	return buf.getShort();
+    }
+
+    public ByteBuffer putShort(short value) {
+    	buf.putShort(value);
+    	return this;
+    }
+
+    public short getShort(int index) {
+    	return buf.getShort(index);
+    }
+
+    public ByteBuffer putShort(int index, short value) {
+    	buf.putShort(index, value);
+    	return this;
+    }
+
+    public ShortBuffer asShortBuffer() {
+    	return buf.asShortBuffer();
+    }
+
+    public int getInt() {
+    	return buf.getInt();
+    }
+
+    public ByteBuffer putInt(int value) {
+    	buf.putInt(value);
+    	return this;
+    }
+
+    public int getInt(int index) {
+    	return buf.getInt(index);
+    }
+
+    public ByteBuffer putInt(int index, int value) {
+    	buf.putInt(index, value);
+    	return this;
+    }
+
+    public IntBuffer asIntBuffer() {
+    	return buf.asIntBuffer();
+    }
+
+    public long getLong() {
+    	return buf.getLong();
+    }
+
+    public ByteBuffer putLong(long value) {
+    	buf.putLong(value);
+    	return this;
+    }
+
+    public long getLong(int index) {
+    	return buf.getLong(index);
+    }
+
+    public ByteBuffer putLong(int index, long value) {
+    	buf.putLong(index, value);
+    	return this;
+    }
+
+    public LongBuffer asLongBuffer() {
+    	return buf.asLongBuffer();
+    }
+
+    public float getFloat() {
+    	return buf.getFloat();
+    }
+
+    public ByteBuffer putFloat(float value) {
+    	buf.putFloat(value);
+    	return this;
+    }
+
+    public float getFloat(int index) {
+    	return buf.getFloat(index);
+    }
+
+    public ByteBuffer putFloat(int index, float value) {
+    	buf.putFloat(index, value);
+    	return this;
+    }
+
+    public FloatBuffer asFloatBuffer() {
+    	return buf.asFloatBuffer();
+    }
+
+    public double getDouble() {
+    	return buf.getDouble();
+    }
+
+    public ByteBuffer putDouble(double value) {
+    	buf.putDouble(value);
+    	return this;
+    }
+
+    public double getDouble(int index) {
+    	return buf.getDouble(index);
+    }
+
+    public ByteBuffer putDouble(int index, double value) {
+    	buf.putDouble(index, value);
+    	return this;
+    }
+
+    public DoubleBuffer asDoubleBuffer() {
+    	return buf.asDoubleBuffer();
+    }
+}
\ No newline at end of file

Copied: incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBufferPool.java
(from r123314, incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBufferPool.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java&r1=123314&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBufferPool.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/common/ByteBufferPool.java
Fri Dec 24 22:08:01 2004
@@ -16,9 +16,9 @@
  *   limitations under the License.
  *
  */
-package org.apache.mina.util;
+package org.apache.mina.common;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.util.Stack;
 
 /**
  * TODO Insert type comment.
@@ -69,7 +69,7 @@
 			buf = (ByteBuffer) stack.pop();
     		if (buf == null)
     		{
-    			buf = ByteBuffer.allocateDirect( bufferStackSizes[ idx ] );
+    			buf = new ByteBuffer(java.nio.ByteBuffer.allocateDirect( bufferStackSizes[ idx ] ));
     		}
 		}
 		

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java	Fri
Dec 24 22:08:01 2004
@@ -18,8 +18,7 @@
  */
 package org.apache.mina.io;
 
-import java.nio.ByteBuffer;
-
+import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
 
 /**

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
Fri Dec 24 22:08:01 2004
@@ -18,8 +18,7 @@
  */
 package org.apache.mina.io;
 
-import java.nio.ByteBuffer;
-
+import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
 
 /**

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.io;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 import org.apache.mina.common.IdleStatus;
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.io;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 import org.apache.mina.common.IdleStatus;
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	Fri
Dec 24 22:08:01 2004
@@ -19,8 +19,8 @@
 package org.apache.mina.io;
 
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
 
+import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 
@@ -37,10 +37,6 @@
     void close();
 
     void write( ByteBuffer buf, Object marker );
-
-    void write( byte[] buf, Object marker );
-
-    void write( byte[] buf, int offset, int length, Object marker );
 
     Object getAttachment();
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
Fri Dec 24 22:08:01 2004
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
@@ -31,11 +30,12 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.io.Acceptor;
 import org.apache.mina.io.ExceptionMonitor;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilter;
-import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.DefaultExceptionMonitor;
 import org.apache.mina.util.IoHandlerFilterManager;
 import org.apache.mina.util.Queue;
@@ -249,7 +249,7 @@
         try
         {
             SocketAddress remoteAddress = session.getChannel()
-                    .receive( readBuf );
+                    .receive( readBuf.buf() );
             if( remoteAddress != null )
             {
                 readBuf.flip();
@@ -325,7 +325,7 @@
                 continue;
             }
 
-            int writtenBytes = ch.send( buf, session.getRemoteAddress() );
+            int writtenBytes = ch.send( buf.buf(), session.getRemoteAddress() );
 
             SelectionKey key = session.getSelectionKey();
             if( writtenBytes == 0 )

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
Fri Dec 24 22:08:01 2004
@@ -21,7 +21,7 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
@@ -29,12 +29,12 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.io.Connector;
 import org.apache.mina.io.ExceptionMonitor;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilter;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.DefaultExceptionMonitor;
 import org.apache.mina.util.IoHandlerFilterManager;
 import org.apache.mina.util.Queue;
@@ -242,7 +242,7 @@
         ByteBuffer readBuf = ByteBufferPool.allocate( 2048 );
         try
         {
-            int readBytes = session.getChannel().read( readBuf );
+            int readBytes = session.getChannel().read( readBuf.buf() );
             if( readBytes > 0 )
             {
                 readBuf.flip();
@@ -316,7 +316,7 @@
                 continue;
             }
 
-            int writtenBytes = ch.write( buf );
+            int writtenBytes = ch.write( buf.buf() );
 
             SelectionKey key = session.getSelectionKey();
             if( writtenBytes == 0 )

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSession.java
Fri Dec 24 22:08:01 2004
@@ -19,7 +19,7 @@
 package org.apache.mina.io.datagram;
 
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
 
@@ -139,16 +139,6 @@
     Queue getWriteMarkerQueue()
     {
         return writeMarkerQueue;
-    }
-
-    public void write( byte[] buf, int offset, int length, Object marker )
-    {
-        write( ByteBuffer.wrap( buf, offset, length ), marker );
-    }
-
-    public void write( byte[] buf, Object marker )
-    {
-        write( ByteBuffer.wrap( buf ), marker );
     }
 
     public void write( ByteBuffer buf, Object marker )

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
Fri Dec 24 22:08:01 2004
@@ -21,7 +21,7 @@
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.util.HashSet;
 import java.util.Set;
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.io.filter;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
 import java.util.Iterator;

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Fri Dec 24 22:08:01 2004
@@ -19,17 +19,17 @@
 package org.apache.mina.io.socket;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.WriteTimeoutException;
-import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.Queue;
 
 /**
@@ -244,7 +244,7 @@
 
                 try
                 {
-                    while( ( ret = ch.read( buf ) ) > 0 )
+                    while( ( ret = ch.read( buf.buf() ) ) > 0 )
                     {
                         readBytes += ret;
                     }
@@ -424,7 +424,7 @@
 
             try
             {
-                ch.write( buf );
+                ch.write( buf.buf() );
             }
             finally
             {

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
Fri Dec 24 22:08:01 2004
@@ -19,15 +19,15 @@
 package org.apache.mina.io.socket;
 
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.IoHandlerFilterManager;
 import org.apache.mina.util.Queue;
 
@@ -84,7 +84,7 @@
         this.filterManager = filterManager;
         this.ch = ch;
         this.config = new SocketSessionConfig( ch );
-        this.readBuf = ( ByteBuffer ) ByteBufferPool.allocate( 4096 ).limit( 0 );
+        this.readBuf = ByteBufferPool.allocate( 4096 ).limit( 0 );
         this.writeBufferQueue = new Queue();
         this.writeMarkerQueue = new Queue();
         this.handler = defaultHandler;
@@ -150,16 +150,6 @@
     Queue getWriteMarkerQueue()
     {
         return writeMarkerQueue;
-    }
-
-    public void write( byte[] buf, int offset, int length, Object marker )
-    {
-        write( ByteBuffer.wrap( buf, offset, length ), marker );
-    }
-
-    public void write( byte[] buf, Object marker )
-    {
-        write( ByteBuffer.wrap( buf ), marker );
     }
 
     public void write( ByteBuffer buf, Object marker )

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Fri Dec 24 22:08:01 2004
@@ -19,13 +19,13 @@
 package org.apache.mina.protocol;
 
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.ProtocolHandlerFilterManager;
 import org.apache.mina.util.Queue;
 
@@ -332,16 +332,6 @@
         public void write( ByteBuffer buf )
         {
             session.write( buf, message );
-        }
-
-        public void write( byte[] buf )
-        {
-            session.write( buf, message );
-        }
-
-        public void write( byte[] buf, int offset, int length )
-        {
-            session.write( buf, offset, length, message );
         }
     }
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.protocol;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 /**
  * TODO Insert type comment.

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.protocol;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 /**
  * TODO Document me.
@@ -29,8 +29,4 @@
 public interface ProtocolEncoderOutput
 {
     void write( ByteBuffer buf );
-
-    void write( byte[] buf );
-
-    void write( byte[] buf, int offset, int length );
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolViolationException.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.protocol;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 import org.apache.mina.util.ByteBuffers;
 

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBufferPool.java?view=auto&rev=123316
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ByteBuffers.java
Fri Dec 24 22:08:01 2004
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.util;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
 /**
  * @author Trustin Lee (trustin@apache.org)

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java?view=diff&rev=123317&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java&r1=123316&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java&r2=123317
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
Fri Dec 24 22:08:01 2004
@@ -18,8 +18,9 @@
  */
 package org.apache.mina.util;
 
-import java.nio.ByteBuffer;
+import org.apache.mina.common.ByteBuffer;
 
+import org.apache.mina.common.ByteBufferPool;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilter;

Mime
View raw message