blob: 961a7b3ec7c029b9b595beb4e4713639cd23605b [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * @author Sergey I. Salishev
19 * @version $Revision: 1.2 $
20 */
21package javax.imageio.stream;
22
23/**
24* @author Sergey I. Salishev
25* @version $Revision: 1.2 $
26*/
27
28/**
29 * The IIOByteBuffer class represents a byte array with offset and
30 * length that is used by ImageInputStream for obtaining a sequence
31 * of bytes.
32 */
33public class IIOByteBuffer {
34
35 /** The data. */
36 private byte[] data;
37
38 /** The offset. */
39 private int offset;
40
41 /** The length. */
42 private int length;
43
44 /**
45 * Instantiates a new IIOByteBuffer.
46 *
47 * @param data the byte array.
48 * @param offset the offset in the array.
49 * @param length the length of array.
50 */
51 public IIOByteBuffer(byte[] data, int offset, int length) {
52 this.data = data;
53 this.offset = offset;
54 this.length = length;
55 }
56
57 /**
58 * Gets the byte array of this IIOByteBuffer.
59 *
60 * @return the byte array.
61 */
62 public byte[] getData() {
63 return data;
64 }
65
66 /**
67 * Gets the length in the array which will be used.
68 *
69 * @return the length of the data.
70 */
71 public int getLength() {
72 return length;
73 }
74
75 /**
76 * Gets the offset of this IIOByteBuffer.
77 *
78 * @return the offset of this IIOByteBuffer.
79 */
80 public int getOffset() {
81 return offset;
82 }
83
84 /**
85 * Sets the new data array to this IIOByteBuffer object.
86 *
87 * @param data the new data array.
88 */
89 public void setData(byte[] data) {
90 this.data = data;
91 }
92
93 /**
94 * Sets the length of data which will be used.
95 *
96 * @param length the new length.
97 */
98 public void setLength(int length) {
99 this.length = length;
100 }
101
102 /**
103 * Sets the offset in the data array of this IIOByteBuffer.
104 *
105 * @param offset the new offset.
106 */
107 public void setOffset(int offset) {
108 this.offset = offset;
109 }
110}
111