Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    JavaArray 4.7

    Download button

    No screenshots available
    Downloads: 308  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mark Ethan Trostler | More programs
    Perl Artistic License / FREE
    June 2nd, 2007, 06:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    JavaArray description

    JavaArray is a tie'd extension for Java arrays from Java.pm

    JavaArray is a tie'd extension for Java arrays from Java.pm

    SYNOPSIS

    use Java;

    # Set up Java.pm to always return tied array references to me
    my $java = new Java(use_tied_arrays => 1);
    my $tied_array = $java->create_array("java.lang.String",5);

    OR

    # Roll my own tied arrays
    my @tied_array;
    tie @tied_array, 'JavaArray', $java->create_array("java.lang.String",5);
    OR
    tie @tied_array, 'JavaArray', $some_object_that_is_an_array;

    // Set array element 3 to "Java is lame"
    $tied_array[3] = "Java is lame";

    // Get array element 3's value
    my $element = $tied_array[3]->get_value();

    // Get length
    my $length = scalar(@tied_array);
    my $size = $#tied_array;

    // Use as parameter you gotta pass the reference!
    my $list = $java->java_util_Arrays("asList",@tied_array);

    // NO OTHER ARRAY OPERATIONS ARE AVAILABLE!
    // so no pop or push or unshift or shift or splice
    // Hey even this can't make Java arrays cool!
    // use the Collections framework!

    This module puts a pretty thin veneer over Java.pm objects are are Java arrays. Makes 'em slightly prettier to play with. You can pass as an agrument to the 'tie' any Java object that is an array - either one you created yourself or one that was returned to you by something else.

    You probably should NOT be using this directly, but specify 'use_tied_arrays' in your constructor args to Java.pm.

    In parameter lists

    If you want to use your array in a parameter list you've got to pass in the REFERENCE to your array or things will go haywire... If you specified 'use_tied_arrays' in your Java.pm constructor then you will only receive references back from Java.pm so you've already got the reference. ONLY if you call 'tie' yourself (& I can't really think of why you ever would... BUT) & get the array itself do you need to take its reference when using it in parameter lists.

    Automatic usage

    You can tell Java.pm to automatically convert all Java arrays to their tied counterparts by setting 'use_tied_arrays' in your Java constructor. You will get receive a reference to the tied array so you must use the '->' notation like:

    $array->[3] = "Mark rox";
    my $ele = $array->[4];

    See perldoc Java.pm for more info. You can then use that value directly in parameter lists.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Java arrays | Java.pm script | Perl module | JavaArray | Java | arrays

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM