Method 1 or Method 2

Hi,
Does somebody know the best way to read something from the system.in?
Method 1
=======
InputStreamReader r = new InputStreamReader( System.in );
int maxch = Integer.parseInt(System.getProperty("cgi.CONTENT_LENGTH"));
char [] bf = new char[maxch];
try{
r.read(bf);
}catch(Exception ex){}
String inpbuffer = new String(bf);
Method 2
=======
InputStreamReader r = new InputStreamReader( System.in );
int maxch = Integer.parseInt(System.getProperty("cgi.CONTENT_LENGTH"));
char [] bf = new char[maxch];
int nred = 0;
while (nred < maxch)
try{
nred += r.read(bf,nred,maxch-nred);
}catch (Exception ex){}
String inpbuffer = new String(bf);
Thx in advance
Pieter

Only the second method reads "maxch" bytes from the stream, the first may stop ahead of time.
It looks like you want to read strings, maybe BufferedReader would be a better tool for your task.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html

Similar Messages

  • ABAP OO: methods as method params, method chains

    Hello all,
    I am currently developing quite much ABAP OO and wonder if this is possible, because I got compilation errors.
    a) Methods as method params w/o temp vars:
    I have a method whose parameter shall be the return value (let s say a string) shall be the parameter:
    document->set_owner( owner = person->get_name( ) ).
    This throws an error and I have to code this instead
    data: owner type String.
    ownerString = person->get_owner( ).
    document->set_owner( owner = ownerString ).
    ... so I have always a temp variable which is getting MUCH overhead when having such stuff often...
    Am I doing wrong or is this impossible in ABAP OO? ...am used to do such things in all other languages I know... mean, that methods can be params of other methods.
    b) "chaining of methods"
    Is this possible somehow?:
    data: tmp type String.
    tmp = employee->get_orgUnit( )->get_name( ).
    Calling one level (the get_OrgUnit() method) works fine, but an immediate call to the second level ( get_name() method) fails and I have to code this:
    data: tmp     type String,
          orgUnit type ZOrgUnit.
    orgUnit = employee->get_orgUnit( ).
    tmp = orgUnit->get_name( ).
    This also very annoying to have so much temporary help variables on the way.
    Is there any help for me?
    Thank you for any hints and reagrds,
    Timo

    Hi Timo,
    as Richard's reply says it's impossible in ABAP-OO. The nature of this language is ABAP not OO
    Only helpful for you, could be the returning parameter. It's very useful in conditional expressions like
    if m1->a() = '2'.
    A preferred parameter to avoid writing parameter names like
    m1->b( '2' ).
    All other useful stuff of method or parameter chaining, and so on is NOT possible. Sorry.

  • Getting problem with DOMImplementation classes method getFeature() method

    hi
    getting problem with DOMImplementation classes method getFeature() method
    Error is cannot find symbol getFeature()
    code snippet is like...
    private void saveXml(Document document, String path) throws IOException {
    DOMImplementation implementation = document.getImplementation();
    DOMImplementationLS implementationLS = (DOMImplementationLS) (implementation.getFeature("LS", "3.0"));
    LSSerializer serializer = implementationLS.createLSSerializer();
    LSOutput output = implementationLS.createLSOutput();
    FileOutputStream stream = new FileOutputStream(path);
    output.setByteStream(stream);
    serializer.write(document, output);
    stream.close();
    problem with getFeature() method

    You are probably using an implementation of DOM which does not implement DOM level-3.

  • FATAL ERROR in native method: Wrong Method ID

    I have a piece of C code from which I am trying to launch a piece of Java, but I am having severe problems just trying to get a simple integer value returned from any Java function. I keep getting the error message "FATAL ERROR in native method: Wrong method ID used to invode a Java method"
    My C code looks like :
    JNIEnv *env;
    long result;
    jmethodID mid;
    jclass cls;
    jobjectArray args;
    jstring jstr;
    jint res;
    jobject myObj;
    options[0].optionString = "-Djava.class.path=.";
    options[1].optionString = "-Djava.compiler=NONE";
    options[2].optionString = "-verbose:jni";
    vm_args.version = JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 2;
    vm_args.ignoreUnrecognized = JNI_FALSE;
    // Create the Java VM
    result = JNI_CreateJavaVM(&jvm,(void **)&env, &vm_args);
    if (result == JNI_ERR )
    printf("Can't create Java VM\n");
    exit(1);
    else
    printf("Java VM created successfully\n");
    cls = (*env)->FindClass(env, "Example1");
    if (cls == 0){
    printf("Can't find Class\n");
    exit(1);
    else
    printf("Class Found\n");
    mid = (*env)->GetMethodID(env, cls, "GetIntValue", "()I" );
    if (mid == 0) {
    printf("Can't find function\n");
    exit(1);
    else
    printf("Function Found\n");
    res = (*env)->CallIntMethod(env, cls, mid);
    if (res != 0)
    char pszTempString[256] = {'\0'};
    sprintf (pszJavaString, "Returned from Java the value of %d", res);
    printf("Returned from Java with ");
    printf(pszJavaString);
    My GetMethodID call works correctly and I have checked the signature (using javap -s) and that works fine. I've seen many references on these forums about using NewObject prior to calling CallIntMethod, but if I try to use that I then get the error message "FATAL ERROR in native method: a non-constructor passed to NewObject".
    Any body got any ideas please.
    Thanks

    What I couldn't figure out from your code is where you create the java object that is supposed to return the integer to your C code.
    Alternatives:
    o This is just code snippets, and you really are creating the object.
    o Error - the object should have been created.
    o Error - it is a static method, and you should be finding a static method and calling it on a class object.
    (Other than that, I didn't see anything obviously wrong.

  • FATAL ERROR in native method: Wrong method ID used to invoke a Java method

    When calling the same method second time , I get message ::
    <FATAL ERROR in native method: Wrong method ID used to invoke a Java method>
    void myFunction(int myVal)
    JNIEnv *env = NULL;
    jclass odbcconnls;
    jint res;
    printf("\nInitilaizing class ");
    res = (jvm)->AttachCurrentThread((void **)&env,NULL);
    if (res < 0) {
    fprintf(stderr, "Can't get Env \n");
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;          
    if(res == JNI_OK)
    printf("\nThe env is initialized ");
    if(*(&env) == NULL)
    printf(" the env is NULL ");
    printf("\nenv :::::: %s ", env);     
    // the jobject (dbc->actualConn) is a global reference
    odbcconnls = (env)->GetObjectClass(dbc->actualConn);
    if (odbcconnls == NULL) {
    goto destroy;
    switch(myVal){
    case 1:
    jmethodID methodId ;
    jboolean jbool;
    SQLINTEGER Val = (SQLINTEGER )Value;
    SQLINTEGER val1 = *Val;
    methodId = (env)->GetMethodID( odbcconnls,"myFun1","(Z)V");
    if(methodId == NULL){
    goto destroy;
    if(val1 == SQL_FALSE )
    jbool = 0;
    else
    jbool =1;
    env->CallVoidMethod(dbc->actualConn,methodId,jbool);
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId);
    jvm->DetachCurrentThread();
    return ;
    case 2 :
    jmethodID methodId1 ;
    SQLUINTEGER* Level;
    methodId1 = (env)->GetMethodID( odbcconnls,"myFun2","(I)V");
    if(methodId1 == NULL){
    goto destroy;
    Level = (SQLUINTEGER *)Value;
    env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Level);
    dbc->txn_isolation = (SQLUINTEGER)Value;
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId1);
    jvm->DetachCurrentThread();
    return ;
    case 3 :
    SQLCHAR* Cate;
    jmethodID methodId2 ;
    jstring jStrCat;
    methodId2 = (env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/String;)V");
    if(methodId2 == NULL){
    goto destroy;
    Cate = new SQLCHAR[20];
    strcpy((char *)CCatalog,(char *)Value);
    jStrCat = env->NewStringUTF((char *) Cate);
    printf("\n got jSTring ");
    env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat);
    printf("\n after called method ");
    int len = strlen((char *)Cate);
    dbc->Cate = new SQLCHAR[len+1];
    strcpy((char *)dbc->Cate,(char *)Cate);
    printf("\n copied result ");
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId2);
    jvm->DetachCurrentThread();
    return ;
    destroy:
    if ((env)->ExceptionOccurred()) {
    (env)->ExceptionDescribe();
    jvm->DetachCurrentThread();
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;
    When case 1 is called second time this error is thrown..
    plz help me..
    Thanx
    MittalSunita.

    When calling the same method second time , I get
    message ::
    <FATAL ERROR in native method: Wrong method ID used
    d to invoke a Java method>
    void myFunction(int myVal)
    JNIEnv *env = NULL;
    jclass odbcconnls;
    jint res;
    printf("\nInitilaizing class ");
    res = (jvm)->AttachCurrentThread((void **)&env,NULL);
    if (res < 0) {
    fprintf(stderr, "Can't get Env \n");
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;          
    if(res == JNI_OK)
    printf("\nThe env is initialized ");
    if(*(&env) == NULL)
    printf(" the env is NULL ");
    printf("\nenv :::::: %s ", env);     
    // the jobject (dbc->actualConn) is a global
    reference
    odbcconnls = (env)->GetObjectClass(dbc->actualConn);
    if (odbcconnls == NULL) {
    goto destroy;
    switch(myVal){
    case 1:
    jmethodID methodId ;
    jboolean jbool;
    SQLINTEGER Val = (SQLINTEGER )Value;
    SQLINTEGER val1 = *Val;
    methodId = (env)->GetMethodID(
    ( odbcconnls,"myFun1","(Z)V");
    if(methodId == NULL){
    goto destroy;
    if(val1 == SQL_FALSE )
    jbool = 0;
    else
    jbool =1;
    env->CallVoidMethod(dbc->actualConn,methodId,jbool);
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId);
    jvm->DetachCurrentThread();
    return ;Why do you delete a local reference???
    Did you ever call the get local reference?
    case 2 :
    jmethodID methodId1 ;
    SQLUINTEGER* Level;
    methodId1 = (env)->GetMethodID(
    ( odbcconnls,"myFun2","(I)V");
    if(methodId1 == NULL){
    goto destroy;
    Level = (SQLUINTEGER *)Value;
    env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Le
    el);
    dbc->txn_isolation = (SQLUINTEGER)Value;
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId1);
    jvm->DetachCurrentThread();
    return ;
    case 3 :
    SQLCHAR* Cate;
    jmethodID methodId2 ;
    jstring jStrCat;
    methodId2 =
    (env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/St
    ing;)V");
    if(methodId2 == NULL){
    goto destroy;
    Cate = new SQLCHAR[20];
    strcpy((char *)CCatalog,(char *)Value);
    jStrCat = env->NewStringUTF((char *) Cate);
    printf("\n got jSTring ");
    env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat)
    printf("\n after called method ");
    int len = strlen((char *)Cate);
    dbc->Cate = new SQLCHAR[len+1];
    strcpy((char *)dbc->Cate,(char *)Cate);
    printf("\n copied result ");
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId2);
    jvm->DetachCurrentThread();
    return ;
    destroy:
    if ((env)->ExceptionOccurred()) {
    (env)->ExceptionDescribe();
    jvm->DetachCurrentThread();
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;
    When case 1 is called second time this error is
    thrown..
    plz help me..
    Thanx
    MittalSunita.

  • How to get string which is return from a method and method is called from a filter

    Can anyone please guide me how i will get a string on a template, this string value is return by method which is called through 'ValidateStandered' filter.
    My problem is when i CheckIn a document, i am implementing some validation of duplicated document and duplicated document is identified by some metadata value.
    if metadata value of CheckIn document(current document) is same with existing document then filter will return ddocname and ddoctitle of existing document on a template(user can see the ddocname of existing item).

    please find error logs also:
    intradoc.data.DataException: !csDbCouldNotBind,getValueOfDuplicateDocument
            at intradoc.jdbc.JdbcQueryUtils.buildQuery(JdbcQueryUtils.java:107)
            at intradoc.jdbc.JdbcWorkspace.buildQuery(JdbcWorkspace.java:736)
            at intradoc.jdbc.JdbcWorkspace.createResultSet(JdbcWorkspace.java:639)
            at CheckInRestrictionFilter.CheckInRestrictionFilter.getResultSet(CheckInRestrictionFilter.java:108)
            at CheckInRestrictionFilter.CheckInRestrictionFilter.doFilter(CheckInRestrictionFilter.java:57)
            at intradoc.shared.PluginFilters.filterWithAction(PluginFilters.java:114)
            at intradoc.shared.PluginFilters.filter(PluginFilters.java:68)
            at intradoc.server.DocServiceHandler.validateStandard(DocServiceHandler.java:1251)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:324)
            at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
            at intradoc.server.Service.doCodeEx(Service.java:620)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1483)
            at intradoc.server.Service.doActions(Service.java:559)
            at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1346)
            at intradoc.server.Service.executeSubServiceCode(Service.java:4109)
            at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:1222)
            at intradoc.server.Service.executeServiceEx(Service.java:4104)
            at intradoc.server.Service.executeService(Service.java:4088)
            at intradoc.server.Service.doSubService(Service.java:3998)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
            at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
            at intradoc.server.Service.doCodeEx(Service.java:637)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.Service.doScriptableAction(Service.java:4050)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
            at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
            at intradoc.server.Service.doCodeEx(Service.java:637)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1483)
            at intradoc.server.Service.doActions(Service.java:559)
            at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1415)
            at intradoc.server.Service.executeActions(Service.java:545)
            at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:751)
            at intradoc.server.Service.doRequest(Service.java:1974)
            at intradoc.server.ServiceManager.processCommand(ServiceManager.java:486)
            at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
            at intradoc.idcwls.IdcServletRequestUtils.doRequest(IdcServletRequestUtils.java:1355)
            at intradoc.idcwls.IdcServletRequestUtils.processFilterEvent(IdcServletRequestUtils.java:1732)
            at intradoc.idcwls.IdcIntegrateWrapper.processFilterEvent(IdcIntegrateWrapper.java:223)
            at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at idcservlet.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:87)
            at idcservlet.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:305)
            at idcservlet.common.ClassHelperUtils.executeMethodWithArgs(ClassHelperUtils.java:278)
            at idcservlet.ServletUtils.executeContentServerIntegrateMethodOnConfig(ServletUtils.java:1680)
            at idcservlet.IdcFilter.doFilter(IdcFilter.java:457)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at java.security.AccessController.doPrivileged(Native Method)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at java.security.AccessController.doPrivileged(Native Method)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

  • Passing methods as methods arguments

    Hi,
    how can I pass a method to another method?
    I need something like this:
    public void methodA() {
    System.out.println("Hallo world");
    public void methodB( Method method ) {
    method();
    // or
    method.invoke();
    and in my app:
    methodB( methodA );
    ...of course the code below didn't work :-D
    Thanks.

    sorry, I didn't understood very well the 'inteface
    aproach'. Do you have some example code?If the name of the method to be called truly needs to be dynamic, then this won't work but if you just want different behaviors, then you could do something like this: public interface Doer {
        void doIt();
    public class Doer1 implements Doer {
        void doIt() {
            // do some stuff
    public class Doer2 implements Doer {
        void doIt() {
            // do some other stuff
    public class DoerDriver {
        public static void main(String[] args) {
            for (int ix = 0; ix < args.length; ix++) {
                try {
                    Class klass = Class.forName(args[ix]);
                    Doer doer = (Doer)klass.newInstance();
                    doStuff(doer);
                catch (Exception exc) {
                    System.out.println("Couldn't do " + args[ix]);
                    exc.printStackTrace();
         * This method only exists to follow your model of passing the "method"--i.e., they dynamic
         * bit--to another method. We could just call doer.doIt() right inside the loop in main.
        private static void doStuff(Doer doer) {
            doer.doIt();
    java DoerDriver Doer1 Doer2 Doer2 Doer1
    Whether this works for you depends on what you're really trying to do.

  • Getting all the members (variables, methods AND method bodies) of a java source file

    For a project I want to programmatically get access to the members of java source file (member variables, methods etc) as well as to the source code of those members. My question is what is the best method for this? So far I have found the following methods:
    Use AST's provided by the Java Source API and Java Tree API, as discussed in the following posts:
    http://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html
    http://weblogs.java.net/blog/timboudreau/archive/2008/02/see_java_code_t.html
    http://netbeans.dzone.com/announcements/new-class-visualization-module
    This has the disadvantage that the classes actually have to be compilable. When I look at the Netbeans Navigator view however, it provides me with a nicely formatted UI list, regardless of the "compilable" state of the class.
    Thus I started looking at how to do this... The answer appears to be through the use of tools such as JavaCC: https://javacc.dev.java.net/
    ANTLR: http://www.antlr.org/
    which are lexers and parsers of source code. However, since the Navigator panel already does this, couldn't I use part of this code to get me the list of variables and methods in a source file? Does the Navigator API help in this regard?
    Another route seems to be through tools such as
    BeautyJ: http://beautyj.berlios.de/
    which run on top of JavaCC if I am correct, and which has the ability to provide a clean view on your java code (or an XML view). However, BeautyJ does not seem to be too actively developed, and is only j2se1.4 compatible.
    I hope someone can shed a light on the best way to go about what I want to achieve. Somebody already doing this?
    (I crossposted on the Netbeans forums too, hope this is OK...)

    I'm currently developing a LaTeX editor(MDI) and I do the same thing, but I don't know what exactly do you need.

  • ABAP OO - Passing Internal Tables from Method to Method

    I'm new to writing methods.
    I have a need to build an internal table in METHOD1 and pass the internal table to METHOD2. I'm confused how to declare the table in 'Parameter' section of the METHOD2. I have specified the following:
    Parameter = WTAB1
    Type = Import
    Pass value = blank
    Optonal = Blank
    Typing Method = Type
    Associated type =  ZSCIW and this is declared in DDIC as a data type with fields ZZLINE(72) and ZZPOS(4)
    Default value = blank
    METHOD1 (simplified example)
    method METHOD1.
    Table of individual words from source code
      types: begin of wline,
               WORD(72),
               POSN(4),
             end of wline,
             wlines     type standard table of wline  with default key.
      data:  wx          type wlines,
               wa          like line of wx.
    Clear past results
      REFRESH: Wx.
    Look through source code...
      LOOP AT ref_include->lines into wa.
        APPEND wa.
      ENDLOOP.
    Call METHOD2 and pass internal table wa
    METHOD2 ( ).
    1. How to you define the parameters in METHOD2.
    2. What is the coding in METHOD1 to call METHOD2.
    Your help will really be appreciated.
    Thanks.
    Soyab

    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    go through these links
    http://www.erpgenie.com/abap/index.htm
    http://sic.fh-lu.de/sic/bic.nsf/(vJobangebote)/EC8AD2AE0349CE92C12572200026FDB8/$File/Intern%20or%20Working%20Student%20as%20ABAB%20OO%20Developer.pdf?Open
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    <b>good book on ABAP objects(OOPS)
    http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications</b>
    Rewards if useful..............
    Minal

  • How to enter Enhancement Mode of ABAP OO Classes: Add Methods, Pre-Methods.

    Hello,
    do you know how to enter the enhancement mode of the class builder?
    I want to enhance a standard global ABAP OO class by implicit enhancements for inserting methods, attributes or pre- and post-methods - as described in  <a href="http://help.sap.com/saphelp_nw70/helpdata/en/58/4fb541d3d52d31e10000000a155106/content.htm">Online help</a>.
    I start the SE24 on my NW 7.0, but there is no menu <i>Edit-> Enhancement Operations-> Enhance Class/Interface </i> as written in <a href="http://help.sap.com/saphelp_nw70/helpdata/en/86/b83142680d5c33e10000000a155106/content.htm">Online Help</a>.
    When I press the <i>Display</i> button, there is no enhancement button (the spiral), and the sub entries of menu <i>Edit-> Enhancement Operations</i>, like <i>Insert Pre-Method</i> are inactive (gray).
    In SE80 I don't find them too. The only implicit enhancements I found are on the beginning and end of methods implementation code.
    Do you have experience enhancing classes?
    Best regards
    Michael Umlauff

    Hallo Michael,
    You first have to go in se80 or se24
    Then menu Class-> Enhance
    Then you will be able to use Edit-> Enhancement Operations-> Insert Pre-Post Methodes
    Regards,
    Walter

  • Trying to understand methods - calling methods within own class - help

    I'm trying to write a simple program to search for letters in a string. I'm having a ton op problems; java seems so complicated with a lot of rules.
    The main problem I'm having (for now) is calling a method within the same class as main.
    import java.io.*;
    class LookForLetters{
        public static void main(String[] args)
         int i = 0;     
         int j = 0;
         int l = 0;
         int m = 0;
         String question1 = "Enter the line to be searched"; 
         String question2 = "Enter the line to be searched";       
         returnResponse stringtosearch = new returnResponse(question1); // here's where my problem is
            char[] chartosearch = stringtosearch.toCharArray();
         returnResponse letterstofind = new returnResponse(question2);
            char[] chartofind = letterstofind.toCharArray();     
         int findlength = chartosearch.length();
         int searchlength = chartofind.length();
         int[] k = new int[searchlength];
         for(i = 0; i < findlength; i++)
             for(j = 0; j < searchlength; j++)   
              if(chartosearch[i] == chartofind[j])
                  k[l] = i;
                  l++;
                  System.out.print("T");
             System.out.print(i + " " + l);
                if(l == 0)
                    System.out.print(chartofind[i] + " is the not in the sentence.");
                    System.out.println();       
                else
                    System.out.print(chartofind[i] + " is the ");
                 for(m = 0; m < l; m++)
                     System.out.print(k[l] + " ");
                    System.out.print("letter of your sentence");
                    System.out.println();
                    l = 0;
        public String returnResponse(String question){
         String response = " ";
         System.out.print(question);
         try
             InputStreamReader isr = new InputStreamReader(System.in);
                BufferedReaderbr = new BufferedReader(isr);
             response = br.readLine();            
         catch(IOException e)
             System.out.print("error");
         return response;
    }The compiler says that it can't find the returnResponse method. when I try to instantiate the whole class, it says the package is not included. Please help.

    JoachimSauer wrote:
    DaneWKim wrote:
    thank you very much for your response. I'm sure it's obvious that I'm really confused. I'm used to C and assembly programming, so the OO concepts are really foggy.That particular line doesn't even deal with any OO concept. But the fact that you already know C helps me give a (hopefully) more useful answer:
    What is the return type of the method you're trying to call?
    What is the type of the variable you want to assign the return value to?
    Are those compatible? Or even more general: do they both exist?I changed it to:
            String stringtosearch = returnResponse(question1);
            char[] chartosearch = stringtosearch.toCharArray();
         String letterstofind = returnResponse(question2);
            char[] chartofind = letterstofind.toCharArray();I guess I'm getting confused with medthods, class and types. There's a whole host of new vocabulary and rules with OO and java that have me a bit confused. I appreciate your help.

  • Table name for 'Program name of method' and 'Method name'

    As we know, each method method contains different  program name with ext. like "====CM0001" etc., Where can I find this program name of method in database tables?
    Note: Program names are in REPOSRC with type as 'I' and name as "CLASS NAME======CMXYZ". But here we can not decide with program name belongs to which class!
    Thanks,
    Naveen.I

    Use FM SEO_CLASS_GET_METHOD_INCLUDES. Provide your class name and you will get the method names with include name.
    Regards,
    Naimesh Patel

  • Passing methods to methods?

    I use to program in C++ once upon a time, and one of my favorite tricks was storing procedures in pointers so I could call procedures in parent classes from a sub class.
    Parent (say a scroll bar)
    updatePosition(int)
    child (one of the buttons)
    The child could call the updatePosition() procedure because I would pass it into the child class when I made it. It allowed me to make a button that could activate anything in my code, which was useful.
    Now I'm using Java and I wanted to do something similiar. I'm trying to make a graphical scroll bar (I plan on it's dimensions to change while it's in use, so it can't be an AWT or Swing scrollbar), and I've got some buttons made. I want to do this:
    MyScrollBar {
    int position = 0;
    void updatePosition(int amount) {
    position += amount;
    MyButton upbtn = new MyButton(updatePosition);
    MyButton downbtn = new MyButton(updatePosition);
    Just assume MyButton will respond to mouse clicks (it's workings doesn't matter really). When upbtn is clicked, I want it to be able to call the method in MyScrollBar that I passed into it when it was made. Short of making a MyButton that accepts a MyScrollBar passed to it, is there a way to call the procedure in it's parent?

    I ran into a similar problem, but I used a little trick. Make another class in that same .java file that your making which holds a static variable, where your main method sets up that JScrollbar, assigns it as a variable in that class, then other parts of your code access that JScrollBar through that class.
    class MyScrollBarHolder
      public static MyScrollBar msb;
      public static void setScrollBar(MyScrollBar msbTemp)
      {msb = msbTemp;}
      public void updatePosition()
      {//your code for handling that
    }this just goes at the end of your code. Then when a button wishes to access it, you just call MyScrollBarHolder.updatePosition() or you can get the ScrollBar itself with MyScrollBarHolder.msb
    Hope this helps
    Cheers

  • ABAP objects, drilling down into methods/parameter/method/parameter...

    Hello all,
    When creating or changing purchase orders using the enjoy transactions ME21N and ME22N, I want to force the users to have the same delivery address on every line item. I have found and activated the BADI ME_PROCESS_PO_CUST. I have added some code in method CHECK and put a breakpoint on that code. The transaction is stopping on my breakpoint. So far so good.
    Parameter IM_HEADER is of type IF_PURCHASE_ORDER_MM,
    that has method GET_ITEMS,
    that has parameter RE_ITEMS that is a table of  of type PURCHASE_ORDER_ITEMS,
    method GET_DATA
    with parameter RE_DATA
    with fields ADRNR &  ADRN2
    From inside of the method CHECK of BADI, what syntax do I need to create an internal table of the line item fields that are in parameter RE_DATA of method GET_DATA?  I am just starting to work with ABAP objects.  Any help would be greatly appreciated.
    Thanks
    Bruce

    Uwe,  thanks for the quick response.
    Your solution,
    DATA: lt_items      TYPE purchase_order_items,
               ls_item       TYPE purchase_order_item.
    CALL METHOD im_header->get_items
       receiving
         re_items = lt_items.
    Short version:
      lt_items = im_header->get_items( ).
      LOOP AT lt_items INTO ls_item.
      do something
      ENDLOOP.
    got me very close to the solution.  The table lt_items contain the number of entries corresponding to the actual line items.  But the data element ls_item does not contain the fields I'm expecting from:
    method GET_DATA ,
    parameter RE_DATA,
    type MEPOITEM.
    How do I populate ls_item with the 197 fields from structure MEPOITEM?
    If I knew more about ABAP objects, I'm sure I could easily change the code myself.  But today, I need the generosity of others to help me solve this.
    Thanks
    Bruce

  • Calling abstract method from method, where is functional code

    HI All
    I'm trying to find the actual code that is responsible for the play() method to play sound of Applet or of AudioClip. I looked in the source files and found that the two are circle-refering to each other. Audio clip is an interface so it doesnt specify any code for how the method play() should work. That should be left to the classes that implement it. But the play(URL) method of Applet refers to the the AudioClips method:public void play(URL url) {
    AudioClip clip = getAudioClip(url);
    if (clip != null) {
    clip.play();
    So where is the real code for the method?
    This seems to be very normal because almost all methods in Applet where refering to interfaces like AppletContext an AppletStub.
    How does this work? Can anybody explain?

    This is a design-pattern called "factory-method". The factory-method (here getAudioClip(URL)) has a return value of an interface but really returns an object of a class implementing this interface. The user can call this factory-method and then call the methods of the returned object without knowing wich class this methods implements. If you want to change the implementing class later, you only have to build a new class and to change the factory-method - but the code of the "user" will not change.

  • How to call a method a method

    basically ive got a method that calculates an average to one decimal place...i return this value to the main...when i try to call the function Im getting an error that says the variable cant be found
    any ideas why?

    yeh i changed that.....
    ahem
    I will post the whole thing...but the parts im having problems with will be in bold
    // Purpose: Processing Student Questionnaire Results
    //Importing the Scanner
    import java.util.Scanner;
    public class studentQuestionnaireResults
    // Declaring the global variables
    public static int [] scoreArray;
    public static int numOfScores;
    // ************************* MAIN PROGRAM **************************
    public static void main()
    outputTo1dp(dec);
    // ************************ METHODS ********************************
    // Method to input array integers
    public static void numInArray()
    int num;
    //Bringing the scanner in
    Scanner in = new Scanner(System.in);
    //Asking user for number of scores to be entered
    System.out.println("Please enter the number of scores recorded");
    numOfScores = in.nextInt();
    scoreArray = new int [numOfScores];
    System.out.println("Please enter each score between 1 and 5, then press [ENTER]");
    for (int i = 0; i < numOfScores; i++)
    num = in.nextInt();
    //Ensuring the user enters a number between 1 and 5
    while ((num <1) || (num > 5))
    System.out.println("Please Enter a number between 1 and 5");
    num = in.nextInt();
    scoreArray = num;
    public static double computeAverage(int [] scoreArray)
    int total = 0;
    int average = 0;
    //Adding the numbers together
    for(int i = 0; i < scoreArray.length; i++)
    total = total + scoreArray [i];
    // Dividing the total into an average
    average = (total/scoreArray.length);
    //Returning the average
    return average;
    public static double outputTo1dp(double average)
    //Multiply by 10
    int result = (int)(average*10);
    //Round and take the integer part
    double dec = (Math.round(result)/10.0);
    //Return Result
    return dec;
    public static int roundMultiple(int dec)
    int roundedToNearest5 = (5 * 5)/(23 + 2);
    System.out.println("Nearest Multiple to 5 is: " + roundedToNearest5);
    return roundedToNearest5;

Maybe you are looking for

  • Error in process chain for PCA full load

    Hello everyone, I'm trying to use a process chain in order to delete a previous full load of plan data in a cube prior to the new load (to avoid double records). The successor job in the process chain is loading a delta of actual data into the same c

  • ITunes won't sync music to iPhone 4

    I bought a new laptop a few months ago, and installed iTunes. I moved all my music from my old laptop on to my new one, yet my iPhone 4 will not sync to it. I am not able to simply drag tracks across from my library and onto my iPhone, but instead ha

  • Document management in portal

    Hi, My requirement is to upload documents in portal. I had 3 reporting roles in portal which will be assigned to users I requirement is to have a tab u201CDocumentsu201D (Page/Work set) in each role  where a Folder will be displayed to user and when

  • IMovie v6.0.3 and iMovie 08 install at the same time?

    Can I have 2 version of iMovie installed at the same time? I want to view and maybe use the new version (in iLive08), but everything I have heard about it is not good. I'd like the option to keep the version 6.0.3. Thanks

  • Multiple presentation servers using the same RPD

    Hi everyone, So as most people know, the iPhone has a cool app that allows you to login and look at your OBIEE content. In theory it's really cool, but as it turns out, a lot of the cool graphs default to Flash and Flash is not supported by the iPhon