View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.mina.util.byteaccess;
21  
22  import java.nio.ByteOrder;
23  
24  import org.apache.mina.core.buffer.IoBuffer;
25  
26  /**
27   * Provides absolute write access to a sequence of bytes.
28   * 
29   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
30   */
31  public interface IoAbsoluteWriter {
32  
33      /**
34       * @return the index of the first byte that can be accessed.
35       */
36      int first();
37  
38      /**
39       * @return the index after the last byte that can be accessed.
40       */
41      int last();
42  
43      /**
44       * @return the order of the bytes.
45       */
46      ByteOrder order();
47  
48      /**
49       * Puts a <code>byte</code> at the given index.
50       * 
51       * @param index The position
52       * @param b The byte to put
53       */
54      void put(int index, byte b);
55  
56      /**
57       * Puts bytes from the <code>IoBuffer</code> at the given index.
58       * 
59       * @param index The position
60       * @param bb The bytes to put
61       */
62      void put(int index, IoBuffer bb);
63  
64      /**
65       * Puts a <code>short</code> at the given index.
66       * 
67       * @param index The position
68       * @param s The short to put
69       */
70      void putShort(int index, short s);
71  
72      /**
73       * Puts an <code>int</code> at the given index.
74       * 
75       * @param index The position
76       * @param i The int to put
77       */
78      void putInt(int index, int i);
79  
80      /**
81       * Puts a <code>long</code> at the given index.
82       * 
83       * @param index The position
84       * @param l The long to put
85       */
86      void putLong(int index, long l);
87  
88      /**
89       * Puts a <code>float</code> at the given index.
90       * 
91       * @param index The position
92       * @param f The float to put
93       */
94      void putFloat(int index, float f);
95  
96      /**
97       * Puts a <code>double</code> at the given index.
98       * 
99       * @param index The position
100      * @param d The doubvle to put
101      */
102     void putDouble(int index, double d);
103 
104     /**
105      * Puts a <code>char</code> at the given index.
106      * 
107      * @param index The position
108      * @param c The char to put
109      */
110     void putChar(int index, char c);
111 }