Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6534833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:17:56+00:00 2026-05-25T10:17:56+00:00

I’m trying to convert an Objective C code to Java,but I have a little

  • 0

I’m trying to convert an Objective C code to Java,but I have a little problem with understanding how to do it.

Here is the Objective C code:

+ (StPacket *)initialize:(UInt32)aPacketId packetType:(StPacketType)aPacketType operationType:(StOperationType)aOperationType
               objectOid:(NSString*)aObjectOid objectId:(UInt32)aObjectId dataSize:(UInt32)aDataSize dataHash:(NSString*)aDataHash
                dataType:(StPacketDataType)aDataType packetData:(NSData*)aPacketData {

    StPacket * packet = nil;

    switch (aPacketType) 
    {
            // Special packets
        case ST_OBJECT_TYPE_INFO_START:
        {
            packet = [[StPacketInfoStart alloc] init];

            break;
        }
        case ST_OBJECT_TYPE_INFO_END:
        {
            packet = [[StPacketInfoEnd alloc] init];

            break;
        }
    }

    if (packet)
    {
        [packet setPacketData:aPacketId packetType:aPacketType operationType:aOperationType objectOid:aObjectOid objectId:aObjectId
                     dataSize:aDataSize dataHash:aDataHash dataType:aDataType packetData:aPacketData];
    }

    return [packet autorelease];
}

StPacketInfoStart init :

- (id)init {
    self = [super init];
    if (self)
    {
        locale = nil;
        serverApiVer = nil;
        deviceId = 0;
    }
    return self;
}

So I did it in Java like this :

    public RPCPacket(   int apacketId,
                            RPCPacketType apacketType,
                            RPCOperationType aoperationType,
                            String[] aobjectOid,
                            int aobjectId,
                            int adataSize,
                            String[] adataHash,
                            RPCPacketDataType adataType){

            RPCPacket packet=null;

            switch(apacketType){
                case ST_OBJECT_TYPE_INFO_START:
                {
                    packet = new InfoStartRPCPacket();

                    break;
                }
                case ST_OBJECT_TYPE_INFO_END:
                {
                    packet = new InfoEndRPCPacket();

                    break;
                }
            }
packet = new RPCPacket(adataSize, apacketType, aoperationType, adataHash, adataSize, adataSize, adataHash, adataType);
    }

My question is,is that the right way and if the code in Java is doing the same thing as in Objective C,because now I’m getting an error which is sayin “Implicit super constructor RPCPacket() is undefined for default constructor. Must define an explicit constructor”.
Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:17:57+00:00Added an answer on May 25, 2026 at 10:17 am

    I don’t talk Objective-C, but I’m pretty sure you don’t do the same thing, as the Java code is not correct:

    From the error message (and the name) I take it that your RPCPacket “method” is a constructor. That’s fine, if you want it to be called whenever someone uses new RPCPacket() with the appropriate arguments.

    But at the end of your constructor your *create a new RPCPacket object which is almost always an error: there already is a new RPCPacket object while the constructor is running. It can be accessed using this (or implictly) and it needs to be initialized by that code.

    So instead of trying to create a new RPCPacket object in that method, you should simply set the fields to the appropriate values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.