GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  JAVAARRAY (3)

.ds Aq ’

NAME

JavaArray - Tie’d extension for Java arrays from Java.pm

CONTENTS

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 3s 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 cant make Java arrays cool!
  //    use the Collections framework!



DESCRIPTION

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.

    EXPORT

None by default.

AUTHOR

Mark Ethan Trostler, mark@zzo.com

SEE ALSO

perl(1). Java.pm.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 JAVAARRAY (3) 2003-11-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.