Access to Java jar from Delphi

后端 未结 4 462
遥遥无期
遥遥无期 2020-12-16 22:36

There\'s Java jar binary library with described classes/functions making some usefull things (nothing special just plain Java - no JNI). No sources available.

There\

4条回答
  •  青春惊慌失措
    2020-12-16 23:29

    As a fast and simpler alternative to the low level, time consuming and error prone JNI from Delphi option, you should try Java for Delphi.

    You'll be working with an object oriented API, would need a fraction of the code when compared to JNI and solve your Delphi/Java integration problem in a few hours instead of days, weeks (or months depending on the use case).

    As an example, below is the public declaration of the Delphi type corresponding to java.lang.String with a code extract showing how it can be used.

    Don't hesitate to contact J4SOFT, will be glad to help you.

    Procedure Sample;
    var
      AJavaString: Ijava_lang_String;
      AValue: string;
    begin
      AJavaString := Tjava_lang_String.Create('A value'); 
      AValue :=  AjavaString.ToString;
      if AJavaString.StartsWith('A') then
      ...
    end;
    
    ...
    type
      Tjava_lang_String = class(Tjava_lang_Object, Ijava_lang_String)
      public
        constructor Create;
        constructor Create(p0: string);
        constructor Create(p0: Ijava_lang_StringBuffer);
        constructor Create(p0: Ijava_lang_StringBuilder);
        constructor Create(p0: TjxByte1DArray);
        constructor Create(p0: TjxByte1DArray; p1: Longint);
        constructor Create(p0: TjxByte1DArray; p1: Longint; p2: Longint);
        constructor Create(p0: TjxByte1DArray; p1: Longint; p2: Longint; p3: Longint);
        constructor Create(p0: TjxByte1DArray; p1: Longint; p2: Longint; p3: string);
        constructor Create(p0: TjxByte1DArray; p1: string);
        constructor Create(p0: TjxChar1DArray);
        constructor Create(p0: TjxChar1DArray; p1: Longint; p2: Longint);
        constructor Create(p0: TjxInt1DArray; p1: Longint; p2: Longint);
        function CharAt(p0: Longint): Char;
        function CodePointAt(p0: Longint): Longint;
        function CodePointBefore(p0: Longint): Longint;
        function CodePointCount(p0: Longint; p1: Longint): Longint;
        function CompareTo(p0: string): Longint;
        function CompareToIgnoreCase(p0: string): Longint;
        function Concat(p0: string): string;
        function ContentEquals(p0: Ijava_lang_StringBuffer): Boolean;
        class function CopyValueOf(p0: TjxChar1DArray): string;
        class function CopyValueOf(p0: TjxChar1DArray; p1: Longint; p2: Longint): string;
        function EndsWith(p0: string): Boolean;
        function Equals(p0: Ijava_lang_Object): Boolean; reintroduce;
        function EqualsIgnoreCase(p0: string): Boolean;
        class function Format(p0: string; p1: Tjava_lang_Object1DArray): string;
        function GetBytes: TjxByte1DArray;
        procedure GetBytes(p0: Longint; p1: Longint; p2: TjxByte1DArray; p3: Longint);
        function GetBytes(p0: string): TjxByte1DArray;
        procedure GetChars(p0: Longint; p1: Longint; p2: TjxChar1DArray; p3: Longint);
        function HashCode: Longint;
        function IndexOf(p0: Longint): Longint;
        function IndexOf(p0: Longint; p1: Longint): Longint;
        function IndexOf(p0: string): Longint;
        function IndexOf(p0: string; p1: Longint): Longint;
        function Intern: string;
        function IsEmpty: Boolean;
        function LastIndexOf(p0: Longint): Longint;
        function LastIndexOf(p0: Longint; p1: Longint): Longint;
        function LastIndexOf(p0: string): Longint;
        function LastIndexOf(p0: string; p1: Longint): Longint;
        function Length_: Longint;
        function Matches(p0: string): Boolean;
        function OffsetByCodePoints(p0: Longint; p1: Longint): Longint;
        function RegionMatches(p0: Longint; p1: string; p2: Longint; p3: Longint): Boolean;
        function RegionMatches(p0: Boolean; p1: Longint; p2: string; p3: Longint; p4: Longint): Boolean;
        function Replace(p0: Char; p1: Char): string;
        function ReplaceAll(p0: string; p1: string): string;
        function ReplaceFirst(p0: string; p1: string): string;
        function Split(p0: string): TjxString1DArray;
        function Split(p0: string; p1: Longint): TjxString1DArray;
        function StartsWith(p0: string): Boolean;
        function StartsWith(p0: string; p1: Longint): Boolean;
        function Substring(p0: Longint): string;
        function Substring(p0: Longint; p1: Longint): string;
        function ToCharArray: TjxChar1DArray;
        function ToLowerCase: string;
        function ToString: string;
        function ToUpperCase: string;
        function Trim: string;
        class function ValueOf(p0: Char): string;
        class function ValueOf(p0: Double): string;
        class function ValueOf(p0: Single): string;
        class function ValueOf(p0: Longint): string;
        class function ValueOf(p0: Int64): string;
        class function ValueOf(p0: Ijava_lang_Object): string;
        class function ValueOf(p0: Boolean): string;
        class function ValueOf(p0: TjxChar1DArray): string;
        class function ValueOf(p0: TjxChar1DArray; p1: Longint; p2: Longint): string;
        property CASE_INSENSITIVE_ORDER;
      end;
    

提交回复
热议问题