6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.tools.jaotc.binformat.macho; 25 26 27 import java.nio.ByteBuffer; 28 import java.nio.ByteOrder; 29 import jdk.tools.jaotc.binformat.macho.MachOTargetInfo; 30 import jdk.tools.jaotc.binformat.macho.MachO.mach_header_64; 31 32 public class MachOByteBuffer { 33 34 public static ByteBuffer allocate(int size) { 35 ByteBuffer buf = ByteBuffer.allocate(size); 36 if (MachOTargetInfo.getMachOEndian() == 37 MachO.mach_header_64.CPU_SUBTYPE_LITTLE_ENDIAN) 38 buf.order(ByteOrder.LITTLE_ENDIAN); 39 else 40 buf.order(ByteOrder.BIG_ENDIAN); 41 return (buf); 42 } 43 44 } | 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.tools.jaotc.binformat.macho; 25 26 import java.nio.ByteBuffer; 27 import java.nio.ByteOrder; 28 import jdk.tools.jaotc.binformat.macho.MachOTargetInfo; 29 30 final class MachOByteBuffer { 31 32 static ByteBuffer allocate(int size) { 33 ByteBuffer buf = ByteBuffer.allocate(size); 34 if (MachOTargetInfo.getMachOEndian() == MachO.mach_header_64.CPU_SUBTYPE_LITTLE_ENDIAN) { 35 buf.order(ByteOrder.LITTLE_ENDIAN); 36 } else { 37 buf.order(ByteOrder.BIG_ENDIAN); 38 } 39 return (buf); 40 } 41 42 } |