001/* 002 * jDTAUS Core SPI 003 * Copyright (C) 2005 Christian Schulte 004 * <cs@schulte.it> 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License, or any later version. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 019 * 020 */ 021package org.jdtaus.core.lang.spi; 022 023/** 024 * Manages memory allocations. 025 * <p>jDTAUS Core SPI {@code MemoryManager} specification to be used by 026 * implementations when allocating memory.</p> 027 * 028 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 029 * @version $JDTAUS: MemoryManager.java 8641 2012-09-27 06:45:17Z schulte $ 030 * @see org.jdtaus.core.container.Container 031 */ 032public interface MemoryManager extends org.jdtaus.core.lang.Runtime 033{ 034 //--MemoryManager----------------------------------------------------------- 035 036 /** 037 * Creates a new buffer of byte values. 038 * 039 * @param requested desired size of the buffer. 040 * 041 * @return a new buffer with length {@code requested}. 042 * 043 * @throws IllegalArgumentException if {@code requested} is negative. 044 * @throws OutOfMemoryError if there is not enough memory available. 045 */ 046 byte[] allocateBytes( int requested ); 047 048 /** 049 * Creates a new buffer of short values. 050 * 051 * @param requested desired size of the buffer. 052 * 053 * @return a new buffer with length {@code requested}. 054 * 055 * @throws IllegalArgumentException if {@code requested} is negative. 056 * @throws OutOfMemoryError if there is not enough memory available. 057 */ 058 short[] allocateShorts( int requested ); 059 060 /** 061 * Creates a new buffer of integer values. 062 * 063 * @param requested desired size of the buffer. 064 * 065 * @return a new buffer with length {@code requested}. 066 * 067 * @throws IllegalArgumentException if {@code requested} is negative. 068 * @throws OutOfMemoryError if there is not enough memory available. 069 */ 070 int[] allocateIntegers( int requested ); 071 072 /** 073 * Creates a new buffer of long values. 074 * 075 * @param requested desired size of the buffer. 076 * 077 * @return a new buffer with length {@code requested}. 078 * 079 * @throws IllegalArgumentException if {@code requested} is negative. 080 * @throws OutOfMemoryError if there is not enough memory available. 081 */ 082 long[] allocateLongs( int requested ); 083 084 /** 085 * Creates a new buffer of char values. 086 * 087 * @param requested desired size of the buffer. 088 * 089 * @return a new buffer with length {@code requested}. 090 * 091 * @throws IllegalArgumentException if {@code requested} is negative. 092 * @throws OutOfMemoryError if there is not enough memory available. 093 */ 094 char[] allocateChars( int requested ); 095 096 /** 097 * Creates a new buffer of float values. 098 * 099 * @param requested desired size of the buffer. 100 * 101 * @return a new buffer with length {@code requested}. 102 * 103 * @throws IllegalArgumentException if {@code requested} is negative. 104 * @throws OutOfMemoryError if there is not enough memory available. 105 */ 106 float[] allocateFloats( int requested ); 107 108 /** 109 * Creates a new buffer of double values. 110 * 111 * @param requested desired size of the buffer. 112 * 113 * @return a new buffer with length {@code requested}. 114 * 115 * @throws IllegalArgumentException if {@code requested} is negative. 116 * @throws OutOfMemoryError if there is not enough memory available. 117 */ 118 double[] allocateDoubles( int requested ); 119 120 /** 121 * Creates a new buffer of boolean values. 122 * 123 * @param requested desired size of the buffer. 124 * 125 * @return a new buffer with length {@code requested}. 126 * 127 * @throws IllegalArgumentException if {@code requested} is negative. 128 * @throws OutOfMemoryError if there is not enough memory available. 129 */ 130 boolean[] allocateBoolean( int requested ); 131 132 //-----------------------------------------------------------MemoryManager-- 133}