2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 290N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 290N/A * This code is free software; you can redistribute it and/or modify it 290N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 290N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 290N/A * This code is distributed in the hope that it will be useful, but WITHOUT 290N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 290N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 290N/A * version 2 for more details (a copy is included in the LICENSE file that 290N/A * accompanied this code). 290N/A * You should have received a copy of the GNU General Public License version 290N/A * 2 along with this work; if not, write to the Free Software Foundation, 290N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 290N/A/* **************************************************************** 290N/A ****************************************************************** 290N/A ****************************************************************** 290N/A *** COPYRIGHT (c) Eastman Kodak Company, 1997 290N/A *** As an unpublished work pursuant to Title 17 of the United 290N/A *** States Code. All rights reserved. 290N/A ****************************************************************** 290N/A ****************************************************************** 290N/A ******************************************************************/ 290N/A * This class extends <CODE>DataBuffer</CODE> and stores data internally as bytes. 290N/A * Values stored in the byte array(s) of this <CODE>DataBuffer</CODE> are treated as 290N/A * <a name="optimizations"> 290N/A * Note that some implementations may function more efficiently 290N/A * if they can maintain control over how the data for an image is 290N/A * For example, optimizations such as caching an image in video 290N/A * memory require that the implementation track all modifications 290N/A * Other implementations may operate better if they can store the 290N/A * data in locations other than a Java array. 290N/A * To maintain optimum compatibility with various optimizations 290N/A * it is best to avoid constructors and methods which expose the 290N/A * underlying storage as a Java array, as noted below in the 290N/A * documentation for those methods. 290N/A /** The default data bank. */ 290N/A * Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank and the 290N/A * @param size The size of the <CODE>DataBuffer</CODE>. 290N/A * Constructs a byte based <CODE>DataBuffer</CODE> with the specified number of 290N/A * banks all of which are the specified size. 290N/A * @param size The size of the banks in the <CODE>DataBuffer</CODE>. 290N/A * @param numBanks The number of banks in the a<CODE>DataBuffer</CODE>. 290N/A * Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank using the 290N/A * Only the first <CODE>size</CODE> elements should be used by accessors of 290N/A * this <CODE>DataBuffer</CODE>. <CODE>dataArray</CODE> must be large enough to 290N/A * hold <CODE>size</CODE> elements. 290N/A * Note that {@code DataBuffer} objects created by this constructor 290N/A * may be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @param dataArray The byte array for the <CODE>DataBuffer</CODE>. 290N/A * @param size The size of the <CODE>DataBuffer</CODE> bank. 290N/A * Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank using the 290N/A * specified array, size, and offset. <CODE>dataArray</CODE> must have at least 290N/A * <CODE>offset</CODE> + <CODE>size</CODE> elements. Only elements <CODE>offset</CODE> 290N/A * through <CODE>offset</CODE> + <CODE>size</CODE> - 1 290N/A * should be used by accessors of this <CODE>DataBuffer</CODE>. 290N/A * Note that {@code DataBuffer} objects created by this constructor 290N/A * may be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @param dataArray The byte array for the <CODE>DataBuffer</CODE>. 290N/A * @param size The size of the <CODE>DataBuffer</CODE> bank. 290N/A * @param offset The offset into the <CODE>dataArray</CODE>. <CODE>dataArray</CODE> 290N/A * must have at least <CODE>offset</CODE> + <CODE>size</CODE> elements. 290N/A * Constructs a byte-based <CODE>DataBuffer</CODE> with the specified arrays. 290N/A * The number of banks is equal to <CODE>dataArray.length</CODE>. 290N/A * Only the first <CODE>size</CODE> elements of each array should be used by 290N/A * accessors of this <CODE>DataBuffer</CODE>. 290N/A * Note that {@code DataBuffer} objects created by this constructor 290N/A * may be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @param dataArray The byte arrays for the <CODE>DataBuffer</CODE>. 290N/A * @param size The size of the banks in the <CODE>DataBuffer</CODE>. 290N/A * Constructs a byte-based <CODE>DataBuffer</CODE> with the specified arrays, size, 290N/A * The number of banks is equal to <CODE>dataArray.length</CODE>. Each array must 290N/A * be at least as large as <CODE>size</CODE> + the corresponding <CODE>offset</CODE>. 290N/A * There must be an entry in the <CODE>offset</CODE> array for each <CODE>dataArray</CODE> 290N/A * entry. For each bank, only elements <CODE>offset</CODE> through 290N/A * <CODE>offset</CODE> + <CODE>size</CODE> - 1 should be used by accessors of this 290N/A * <CODE>DataBuffer</CODE>. 290N/A * Note that {@code DataBuffer} objects created by this constructor 290N/A * may be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @param dataArray The byte arrays for the <CODE>DataBuffer</CODE>. 290N/A * @param size The size of the banks in the <CODE>DataBuffer</CODE>. 290N/A * @param offsets The offsets into each array. 290N/A * Returns the default (first) byte data array. 290N/A * Note that calling this method may cause this {@code DataBuffer} 290N/A * object to be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @return The first byte data array. 290N/A * Returns the data array for the specified bank. 290N/A * Note that calling this method may cause this {@code DataBuffer} 290N/A * object to be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @param bank The bank whose data array you want to get. 290N/A * @return The data array for the specified bank. 290N/A * Returns the data arrays for all banks. 290N/A * Note that calling this method may cause this {@code DataBuffer} 290N/A * object to be incompatible with <a href="#optimizations">performance 290N/A * optimizations</a> used by some implementations (such as caching 290N/A * an associated image in video memory). 290N/A * @return All of the data arrays. 290N/A * Returns the requested data array element from the first (default) bank. 290N/A * @param i The data array element you want to get. 290N/A * @return The requested data array element as an integer. 290N/A * @see #setElem(int, int) 290N/A * @see #setElem(int, int, int) 290N/A * Returns the requested data array element from the specified bank. 290N/A * @param bank The bank from which you want to get a data array element. 290N/A * @param i The data array element you want to get. 290N/A * @return The requested data array element as an integer. 290N/A * @see #setElem(int, int) 290N/A * @see #setElem(int, int, int) 290N/A * Sets the requested data array element in the first (default) bank 290N/A * to the specified value. 290N/A * @param i The data array element you want to set. 290N/A * @param val The integer value to which you want to set the data array element. 290N/A * @see #getElem(int, int) 290N/A * Sets the requested data array element in the specified bank 290N/A * from the given integer. 290N/A * @param bank The bank in which you want to set the data array element. 290N/A * @param i The data array element you want to set. 290N/A * @param val The integer value to which you want to set the specified data array element. 290N/A * @see #getElem(int, int)