Using a function from another file

Dear friends,
I have two different java files in one folder. One is sm.java and the other is AVTransmit2.java. The code below describes the create Transmitter function in the AVTransmit2.java file. Now if i would like to use this function in sm.java, how do i do it ? The create transmitter function is shown below. Thank You, Gan.P
private String createTransmitter() {
// Cheated. Should have checked the type.
PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
PushBufferStream pbss[] = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
int port;
SourceDescription srcDesList[];
for (int i = 0; i < pbss.length; i++) {
try {
rtpMgrs = RTPManager.newInstance();
// The local session address will be created on the
// same port as the the target port. This is necessary
// if you use AVTransmit2 in conjunction with JMStudio.
// JMStudio assumes - in a unicast session - that the
// transmitter transmits from the same port it is receiving
// on and sends RTCP Receiver Reports back to this port of
// the transmitting host.
port = portBase + 2*i;
ipAddr = InetAddress.getByName(ipAddress);
localAddr = new SessionAddress(InetAddress.getLocalHost(),
port);
destAddr = new SessionAddress(ipAddr, port);
rtpMgrs.initialize(localAddr);
rtpMgrs.addTarget(destAddr);
System.err.println( "Created RTP session: " + ipAddress + " " + port);
sendStream = rtpMgrs.createSendStream(dataOutput, i);
sendStream.start();
} catch (Exception e) {
return e.getMessage();
return null;
}

Kalani and Bz,
Thanks for the reply. Now i can call the function ,
but when i write sendStream.start(); it indicates
that, its an error. sendStream.start is in that
function. but i cant call that
Any idea ?
thank you
Gan.PCan you please inform what is the error ?

Similar Messages

  • How do I call a function from another file?

    In MainView.m I have one function -(void)goTell;
    I want to be able to call the function from SecondView.m. How do I do this?
    I have declared the function in the MainView.h and added #include MainView.h to SecondView.m, but it still doesn't work.
    This code crashes my program (for some reason this board takes away my brackets... assume the code is written correctly):
    [[MainView alloc] init];
    MainView *myMainView;
    [myMainView goTell];
    By the way... goTell has nothing in it. It's just a blank function for testing purposes.
    Ethan

    BTW - Wrap your code like this in posts tags so it stay readable.
    put code here
    Your code needs to be:
    MainView *myMainView = [[MainView alloc] init];
    [MyMainView goTell];

  • Calling javascript function from *.js file in Acrobat plug-in

    Hello,
    I had already found that 'AFExecuteThisScript' procedure but ity seems that it execute a script passed in param as a string. What about if I want to execute an external '.js' file ?
    Are there any other function that can do that? What about parsing whole *.js file as a string?
    Do you have any idea or code exaple how to do it?
    Hope this is possible.
    Thanks in advance for your reply.
    Grzegorz

    I have read it, and still don't know how to do that.
    I need to put my config.js script in "app" folder-level - the plugin should be available for all users.
    I have code:
    ACCB1 ASBool ACCB2 PluginInit(void)
        char * jsscript = "config.js";
        AFExecuteThisScript( NULL, jsscript, NULL);
        return true;
    my question is "how to run code from this file, what should variable jsscript contain?? how can I run single functions from this file?
    Another question is:
    is it possible to automaticaly run *.js file from "app" folder-level like it is going from "user" folder-level. I need to create plugin for all users, can't put *.js file for all users in their own folder
    Thanks for the answers.
    Gregory

  • Call a function from another software

    hello,
    Iam working on a program where i have to invoke a function from another software, is there any way i can do that? someone told me that i can use RMI to invoke the function but it seems to me like RMI is mainly for networked and distributed systems. any suggestions? i have an idea in my mind, if the software is programmed using c/c++ i can use the native coding to access the functions, well this is only a blind shot, not sure about it.
    asrar

    Hey asrar,
    It is possible to call external programs from within the JVM. You need to do the following:
    Process p = java.lang.Runtime.getInstance().exec("some.exe");
    You can then do the following:
    p.waitFor();
    This will block until the process returns.
    The Process class gives you access to 3 streams.
    p.getInputStream(); returns a stream that the process sends to stdout.
    p.getErrorStream(); returns a stream that the process sends to stderr.
    p.getOutputStream(); returns a stream that allows you to send data to the process.
    That is basically all you get.
    regards,
    Dr_N35S

  • Initialize a global with a global from another file

    hi,
    I know that initialization order for global variables across compilation units is not defined, but if I have
    file1.cpp
      int x0 = 33, x1 = 55;
      extern int y0, y1;
      static int a[] = { y0, y1 };
      void print_a( void ) { printf( "\na[0] = %d\na[1] = %d", a[0], a[1] ); }
      extern void print_b( void );
      main()
        print_a();
        print_b();
    and file2.cpp
      int y0 = 77, y1 = 99;
      extern int x0, x1;
      static int b[] = { x0, x1 };
      void print_b( void ) { printf( "\nb[0] = %d\nb[1] = %d", b[0], b[1] ); }
    I notice that values are displayed correctly and consequently, initialized in the order I need. So what's the secret, coincidence, am I lucky? Does it make any difference if file2.cpp is part of a static library?
    Thanks

    @ Igor Tandetnik: Yes, I chose an example with circular dependency just to show that it was not the situation that, by luck, the "other" file was was initialized first. Yes, I would like a solution for such circular dependency, but I hope that I will
    find, at least, a solution for the case when such circular dependency does not exist. What I want to achieve? As the title says, I want a solution to be able to initialize globals with globals from another file, a solution as general and fault proof and convenient
    as possible.
    @ Wyck: I thought about something like that, problem is that in case of large arrays there is a lot to type. Another solution (it saves a little typing) I saw was something like
    // common_header.h
    #define LIST_A  y0, y1
    #define LIST_B  x0, x1
    // file1.cpp
    #include "common_header.h"
    Number x0(33), x1(55);
    static Number a[] = { LIST_A };  // just to give correct size
    // file2.cpp
    #include "common_header.h"
    Number y0(77), y1(99);
    static Number b[] = { LIST_B }; // just to give correct size
    // init.cpp
    extern Number LIST_A, LIST_B;
    void init()
    {  Number a_[] = { LIST_A };   Number b_[] = { LIST_B }; // stack usage
       for( int i = 0; i <_countof( a_ ); i++ )  a[ i ] = a_[ i ];
       for( int i = 0; i <_countof( b_ ); i++ )  b[ i ] = b_[ i ];
    This still has the problem of using much stack in case of large arrays and if array members are more complex structures (might also contain string literals), there is a bit more difficult.
    Bellow is a solution I came up with using macros but which I don't really like because is a bit cumbersome. I'm looking for something better/more elegant/safer or simply I want to see what other solutions people see here.
    // file1.cpp -------------------------------------------
    #define MEMBER_LIST( Usage ) \
    Usage( x1 ) \
    Usage( x2 )
    #define IMPORT( ext_member ) extern Number ext_member;
    #define COUNT( member ) 1 +
    #define LOAD( member_val ) a[ i++ ] = member_val;
    Number y1 = 77, y2 = 99;
    MEMBER_LIST( IMPORT )
    static Number a[ MEMBER_LIST( COUNT ) 0 ];
    static void InitGlobals_a( void ) { uint8 i = 0; MEMBER_LIST( LOAD ) }
    extern void InitGlobals_b( void );
    int _tmain(int argc, _TCHAR* argv[])
    { InitGlobals_a();  InitGlobals_b();
    return 0;
    // file2.cpp -------------------------------------------
    #define MEMBER_LIST( Usage ) \
    Usage( y1 ) \
    Usage( y2 )
    #define IMPORT( ext_member ) extern Number ext_member;
    #define COUNT( member ) 1 +
    #define LOAD( member_val ) b[ i++ ] = member_val;
    Number x1 = 33, x2 = 55;
    MEMBER_LIST( IMPORT )
    static Number b[ MEMBER_LIST( COUNT ) 0 ];
    void InitGlobals_b( void ) { uint8 i = 0;  MEMBER_LIST( LOAD ) }
    Of course, something like
    #define MEMBER_LIST( Usage ) Usage( x1 ) Usage( x2 )
    could be further simplified using other macros so you can simple use
    #define MEMBER_LIST x1, x2
    but those additional macros will add up to the complexity.

  • How do you sync music into your library from another file

    how do you sync music into your library from another file?  After moving all my music into a new location, is there a quicker way to upload the music into the library rather than adding file by file?

    Hi MonicaJani,
    Thanks for using Apple Support Communities.  You can also add folders of media as described here:
    Adding music and other content to iTunes
    http://support.apple.com/kb/ht1473
    Adding content on your computer to iTunes
    iTunes helps you add digital audio and video files on your computer directly to your iTunes library. You can add audio files that are in AAC, MP3, WAV, AIFF, Apple Lossless, or Audible.com (.aa) format. If you have unprotected WMA content, iTunes for Windows can convert these files to one of these formats. You can also add video content in QuickTime or MPEG-4 format to iTunes. To learn how to add these files to iTunes follow the steps below.
    Open iTunes
    From the File menu, choose one of the following choices:
    MacAdd to Library
    Windows
    Add File to Library
    Add Folder to Library
    Navigate to and select the file or folder that you want to add
    If iTunes is set to "Copy files to the iTunes Music folder when adding to library," iTunes will copy all content that is added to the iTunes library to the iTunes Music folder. To adjust this setting or change the location of this folder, go to the Advanced tab in iTunes Preferences.
    Cheers,
    - Ari

  • Using Time Machine from another machine to restore Library Folders

    I am using TM from another machine, (which has died) to restore folders onto a working system, some of the folders i need are in the User Library, but how do i display the User Library in TM?
    Thank You
    John

    Hello,
    I have now noticed that the cmd+shift+g method works OK if you are doing a standard restore from the TM on the current system, but does not work when using a TM from another machine. I do not know enough about Unix file structures to specify the correct file under these circumstances, any help woudl be grateful
    Thanks
    John

  • Calling a method from another file

    This is pretty basic stuff but i can't seem to get it right. I am calling a method from another file. The other file IS located in the same folder BUT when i compile i get errors
    "cannot find symbol" <===referring to limit and sieve i believe.
    The method name is "sieve" the file name is "PrimeSieve2008" and "limit" is the variable in brackets in the real method.
         public static void main (String [] args) {
    final int [] PRIMES;
    int sieve = PrimeSieve2008.sieve(limit);
         PRIMES = sieve(getValidInt());
              for (int j = 0; j<PRIMES.length; j++) {
                   System.out.println("Prime[" + j + "] = " + PRIMES[j]);
    Is "int sieve = PrimeSieve2008.sieve(limit)" the wrong way to call a file?
    Thanks a million,
    Alex
    Edited by: Simplistic2099 on Apr 3, 2008 7:47 PM
    Edited by: Simplistic2099 on Apr 3, 2008 7:49 PM

    Simplistic2099 wrote:
    the other method runs fine:
    "public static int[] sieve(final int limit){
    int candidate; // possible prime
    int count; // no. of primes found
    boolean[] mayBePrime = new boolean[limit+1];
    // remaining possibilities
    final int[] PRIMES; // array to return
    // initialize mayBePrime
    for ( int j = 0 ; j <= limit ; j++ ) {
    mayBePrime[j] = true;
    mayBePrime[0] = mayBePrime[1] = false;
    // apply sieve, and count primes
    candidate = 2;
    count = 0;
    while ( candidate <= limit ) {
    if ( mayBePrime[candidate] ) {
    count++;
    for ( int j = 2 * candidate ; j <= limit ; j += candidate ) {
    mayBePrime[j] = false;
    } // end for
    } // end if
    candidate++;
    } // end while
    // fill up new array with the primes found
    PRIMES = new int[count];
    count = 0;
    for (int j = 2 ; j <= limit ; j++ ) {
    if ( mayBePrime[j] ) {
    PRIMES[count] = j;
    count++;
    } // end if
    } // for
    return PRIMES;
    } // sieve
    I really am clueless here.in this one you are passing in limit.
    in the other one you are getting limit from somewhere outside of main.

  • When clicked on an icon in the infopath form, it will open another infopath form from another file. How do?

    When clicked on an icon in the infopath 2013 form, it will open another infopath 2013 form from another
    file. How do?

    Hello Eugene Astafiev!
    I need the following scenario: 
    I have a Sharepoint library with items created by Infopath (form A). 
    I developed another form (form B) that will query items created by form A. 
    The form B will be in a static "webpart" page navigation (Sharepoint). One of these fields returned by the query library that manages the items created is the URL responsible to load the item data . I would like to parameterize the URL into form B.
    So that when the user clicks on it, the form A with their respective data in a modal is returned (which may be a native modal Sharepoint)

  • Can i use App schema from another Oracle database.

    Hi everyone,
    can i use application schema from another Oracle database and how can we do this. the reason is that current database where apex is installed is get very slow because of the size of database and application usage.
    Regards,
    Kashif.

    user10485983 wrote:
    Please update your forum profile with a real handle instead of "user10485983".
    can i use application schema from another Oracle database and how can we do this. the reason is that current database where apex is installed is get very slow because of the size of database and application usage.
    You can (using database links), but this will generally result in even poorer performance (unless by "another Oracle database" you mean using RAC?)
    It sounds more like you either need to upgrade your systems, or refactor your applications to have a smaller performance footprint.

  • Insert Pages From another File?

    HI Everyone,
    Is there a way I can insert entire pages from one file into another?
    I'm working on a document and need several pages from another file - is there a way I can import or insert?
    Cheers
    Darryn

    Open your files & show thumbnails. Sections have a yellow border around all of the pages in that section. Now click on the page in the thumbnail pane & copy. If the file is more than one page & you only want one, you'll need to insert a section break to separate the pages. Then go to your other file, click in the thumbnail pane & paste. The whole copied page will be pasted in. Repeat with another section. Styles will copy over with the sections but headers & footers will not.

  • Js load xml element - style match from another file

    Hi all
    I got a ID file with a placed xml file, all styles are prepaired.
    Now I would like to load the xml element <-> style match from a given template file, where I prepaired all the matches.
    I would imagine this is a bit like loading the styles or the swatches from another file, but have not found any code samples yet.
    Can anybody help?
    Thanks
    Romano

    js for Structure; XML; Map Tags to Styles...
    I don't think that is what I am looking for and I feel I must asked this question in an unclear way...
    so I started a new discussen with the above heading.
    Thank you anyway.
    Romano

  • Impossible to use SAPGETDATA function from an intermediary level of a hierarchy with a cell reference.

    Hi Gurus,
    It is impossible to use SAPGETDATA function from an intermediary level
    of a hierarchy with a cell reference.
    When I open completely a hierarchy node I manage to get the bottom level
    using a cell reference.
    But I cannot do the same thing from a level above.
    I attach screenshots.
    Best regards,
    Thierry Chiret

    Hello,
    I find the soluce :
    Regards,
    Thierry

  • Use a method from another class in another package?

    How can I use a method from another class in another package?

    WhiteJ wrote:
    What do you mean by "new keyword?" You posted this previously:
    I tried that, it seems to not be working. I want to use the constructor from the other class. I imported it, using this piece of code:
    import components.FileChooser;
    components.FileChoser();
    Typically if I am going to call a constructor on a class called Fubar, I'd use new to create a new object:
    Fubar myFubar = new Fubar();Incidently, is it a simple typo in your post or are you trying to use a FileChoser object when it should be FileChooser?

  • Can I use a sim from another carrier when traveling overseas?

    Can I use a sim from another carrier while in Europe or Canada to enjoy local rates and avoid roaming charges?

    If your phone is officially unlocked, yes. Otherwise, no.

Maybe you are looking for

  • Re: Using a second Mac as a screen for a first

    "This tip is ready for consideration"

  • Creating XML

    How can I create an xml string in Java without using the DOM parser? Is there any class I could use to create my xml, like the XmlWriter class in JDK 5. I am using JDK 1.3.1_16.

  • No approval workflow  found error while processing the  Bid Invitation

    We are working on SRM 5.0 (SP level6). We are able to create the bid invitations successfully from the sourcing cockpit. However while saving the changes in the bid invitations, system shows the error "No approval workflow  found". When checked in SW

  • Cannot upgrade aperture 3.1 to the latest 3.2.1

    When I try the upgrade it syas I must have 3.0 to upgrade, then closes. any suggestions to get the upgrade to work??

  • Stock at godown

    Dear All, My one client requirment is as below: From plant material is selling to customer A, Customer A is in chennai city. from plant invoice has been made & physically material are send to customer by road. transporter kepts material in his godown