You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2008/05/22 11:37:23 UTC
svn commit: r659064 - in
/mina/branches/buffer/core/src/main/java/org/apache/mina/queue:
ByteBufferFactory.java HeapByteBufferFactory.java
Author: trustin
Date: Thu May 22 02:37:23 2008
New Revision: 659064
URL: http://svn.apache.org/viewvc?rev=659064&view=rev
Log:
Added ByteBufferFactory and HeapByteBufferFactory
Added:
mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java (with props)
mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java (with props)
Added: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java
URL: http://svn.apache.org/viewvc/mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java?rev=659064&view=auto
==============================================================================
--- mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java (added)
+++ mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java Thu May 22 02:37:23 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.mina.queue;
+
+import java.nio.ByteBuffer;
+
+/**
+ * A factory which creates a new or reused {@link ByteBuffer}.
+ *
+ * @author The Apache MINA project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface ByteBufferFactory {
+ /**
+ * Creates a new or reused {@link ByteBuffer} and returns the created
+ * buffer.
+ *
+ * @param capacity the capacity of the new buffer
+ */
+ ByteBuffer newByteBuffer(int capacity);
+}
Propchange: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/ByteBufferFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java
URL: http://svn.apache.org/viewvc/mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java?rev=659064&view=auto
==============================================================================
--- mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java (added)
+++ mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java Thu May 22 02:37:23 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.mina.queue;
+
+import java.nio.ByteBuffer;
+
+/**
+ * A {@link ByteBufferFactory} which always returns a new heap
+ * {@link ByteBuffer}.
+ *
+ * @author The Apache MINA project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class HeapByteBufferFactory implements ByteBufferFactory {
+ public ByteBuffer newByteBuffer(int capacity) {
+ return ByteBuffer.allocate(capacity);
+ }
+}
Propchange: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: mina/branches/buffer/core/src/main/java/org/apache/mina/queue/HeapByteBufferFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date