Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 52146 invoked from network); 3 Jul 2009 14:44:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Jul 2009 14:44:47 -0000 Received: (qmail 76835 invoked by uid 500); 3 Jul 2009 14:44:57 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 76750 invoked by uid 500); 3 Jul 2009 14:44:57 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 76741 invoked by uid 99); 3 Jul 2009 14:44:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2009 14:44:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2009 14:44:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BDF7623888CF; Fri, 3 Jul 2009 14:44:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r790933 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/Pointer.java main/java/org/apache/commons/runtime/Sizeof.java test/org/apache/commons/runtime/TestPrivate.java Date: Fri, 03 Jul 2009 14:44:32 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090703144432.BDF7623888CF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Fri Jul 3 14:44:32 2009 New Revision: 790933 URL: http://svn.apache.org/viewvc?rev=790933&view=rev Log: Add Sizeof public class Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java (with props) Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java?rev=790933&r1=790932&r2=790933&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Fri Jul 3 14:44:32 2009 @@ -25,6 +25,7 @@ public interface Pointer extends Comparable { + /** * Represents a C/C++ NULL {@code pointer}. */ @@ -46,7 +47,7 @@ * Size of the memory area this pointer consumes. *

* If the {@code this} Pointer does not have a length - * the returned size if Pointer {@code SIZEOF}. + * the returned size if Pointer {@link #SIZEOF}. *

* * @return Internal pointer size. @@ -129,8 +130,7 @@ * @throws NullPointerException if {@code this} or {@code dst} is * {@code null}. */ - public void copy(long srcPos, Pointer dst, - long dstPos, long length) + public void copy(long srcPos, Pointer dst, long dstPos, long length) throws IndexOutOfBoundsException, IllegalArgumentException, NullPointerException; @@ -154,8 +154,7 @@ * @throws NullPointerException if {@code this} or {@code dst} is * {@code null}. */ - public void move(Pointer src, long srcPos, - long dstPos, long length) + public void move(Pointer src, long srcPos, long dstPos, long length) throws IndexOutOfBoundsException, IllegalArgumentException, NullPointerException; Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java?rev=790933&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java (added) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java Fri Jul 3 14:44:32 2009 @@ -0,0 +1,70 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.runtime; +import java.nio.charset.Charset; + +/** + * Primitive native types size info. + * + * @since Runtime 1.0 + * + */ +public final class Sizeof +{ + + private Sizeof() + { + // No class instance + } + + + static { + + INT = Platform.SIZEOF_INT; + LONG = Platform.SIZEOF_LONG; + SIZE_T = Platform.SIZEOF_SIZE_T; + POINTER = Platform.SIZEOF_POINTER; + WCHAR = Platform.SIZEOF_WCHAR; + } + + /** + * Size of the native platform {@code int} type in bytes. + */ + public static final int INT; + + /** + * Size of the native platform {@code long} type in bytes. + */ + public static final int LONG; + + /** + * Size of the native platform {@code size_t} type in bytes. + */ + public static final int SIZE_T; + + /** + * Size of the native platform {@code pointer} type in bytes. + */ + public static final int POINTER; + + /** + * Size of the native platform {@code size_t} type in bytes. + */ + public static final int WCHAR; + +} + Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Sizeof.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java?rev=790933&r1=790932&r2=790933&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (original) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Fri Jul 3 14:44:32 2009 @@ -315,7 +315,7 @@ { Pointer p = test017(0xdeadbeef); assertNotNull("Pointer", p); - String ph = Platform.SIZEOF_POINTER == 4 ? "0xdeadbeef" : "0x00000000deadbeef"; + String ph = Sizeof.POINTER == 4 ? "0xdeadbeef" : "0x00000000deadbeef"; assertEquals("Pointer string ", ph, p.toString()); p = null; System.gc();