2 //#if defined(FOUNDATION10) || defined(J2SE13) || defined(ECLIPSE_FRAGMENT)
4 //## * *****************************************************************************
5 //## * Copyright (C) 2006-2009, International Business Machines
6 //## * Corporation and others. All Rights Reserved.
7 //## * *****************************************************************************
9 //##// dlf13 internal 1.3 compatibility only
11 //##package com.ibm.icu.impl;
16 //##public final class ByteBuffer {
17 //## private byte[] data;
21 //## private int limit;
23 //## private ByteBuffer() {
26 //## public byte[] array() {
27 //## byte[] result = new byte[limit];
28 //## for (int i = 0; i < limit; ++i) {
29 //## result[i] = data[i];
34 //## public static ByteBuffer wrap(byte[] data) {
35 //## if (data == null)
36 //## throw new NullPointerException();
37 //## ByteBuffer result = new ByteBuffer();
38 //## result.data = data;
40 //## result.limit = data.length;
44 //## public int limit() {
48 //## public int position() {
52 //## public int remaining() {
53 //## return limit - pos;
56 //## public byte get() {
58 //## return data[pos++];
59 //## throw new IndexOutOfBoundsException();
62 //## public void get(byte[] dst, int offset, int length) {
63 //## if (offset < 0 || offset + length > dst.length || pos + length > limit) {
64 //## throw new IndexOutOfBoundsException();
66 //## for (int i = 0; i < length; ++i) {
67 //## dst[offset++] = data[pos++];
71 //## public void put(byte b) {
72 //## if (pos < limit) {
75 //## throw new IndexOutOfBoundsException();
79 //## public void put(byte[] src, int offset, int length) {
80 //## if (offset < 0 || offset + length > src.length || pos + length > limit) {
81 //## throw new IndexOutOfBoundsException();
83 //## for (int i = offset; i < offset + length; i++) {
88 //## public void put(byte[] src) {
89 //## put(src, 0, src.length);
92 //## public static final ByteBuffer allocate(int size){
93 //## ByteBuffer ret = new ByteBuffer();
94 //## ret.data = new byte[size];
96 //## ret.limit = size;