You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

IAO

Beginner

  • "IAO" is male
  • "IAO" started this thread

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

1

Thursday, June 13th 2013, 3:33am

Help to translate a line code java to jabaco

Hi...

I need help.
I want to translate this line of java code to Jabaco code.

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
'***Java: InputStream toin;
Dim toin As InputStream 

'***Java: Byte[] buffer = New Byte[1024];   
Dim buffer As Byte = New Byte(1024)

'***Java: int len = -1;
Dim len1 As Integer = -1

'***Java: while ((len = this.toin.read(buffer)) > -1 )  <====HERE I HAVE THE PROBLEM translate 
Do While ((len1 = toin.read() And Buffer) > -1)   <====Exception: java/lang/NullPointerException 
....
....


I hope you can help me. ;(
Thanks in advance... :)


.

This post has been edited 1 times, last edit by "IAO" (Jun 13th 2013, 3:43am)


theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

2

Thursday, June 13th 2013, 6:47pm

Arrays making always problems on Jabaco.

Your code

Jabaco Source

1
2
3
4
5
Dim toin As java#io#InputStream 
Dim buffer As Byte = New Byte(1024)
Dim len1 As Integer = -1
Do While ((len1 = toin.read() And Buffer) > -1) 
Loop
will be compiled to

Jabaco Source

1
2
3
4
InputStream toin = null;
byte buffer = new Byte((byte)1024).byteValue();
int len1 = -1 * 1;
while ((Conversion.CInt((len1 != toin.read() ? 0 : 1) & buffer) <= -1 * 1 ? 0 : 1) != 0);


And remember, that the primitive datatype byte and the object Byte are two different things.
In Jabaco you acces byte, when yiou write Byte.
And you access Byte, when you write java#llang#Byte.


Jabaco Source

1
Byte[] buffer = New Byte[1024];
in Java is something like

Jabaco Source

1
2
Dim buffer() As java#lang#Byte
Redim buffer(1024)
in Jabaco. But this will be compiled to

Jabaco Source

1
2
VBArrayObject buffer = new VBArray();
buffer.setBound(0, 1024, false);


To look, what Jabaco have compiled, it helps, to use a decompiler like
[ JD-GUI ]
For that, running your program in the IDE and then go in the menu to "Project" -> "Open Working Directory". There are the files, you can decompile.

But it isn't sure, if it is allowed to decompile the created files.
And Manuel don't want to answer any questions like that:
[ http://www.jabaco.org/board/p3601-is-jab…d.html#post3601 ]


Greatings
theuserbl

IAO

Beginner

  • "IAO" is male
  • "IAO" started this thread

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

3

Friday, June 14th 2013, 1:47am

Hi to all..

Thank you for your reply mr. theuserbl.

You cleared many doubts in my mind.
I thought that "InputStream", was part of "gnu.io" (RXTX)

I have to study more.
Jabaco is a bit more difficult than BV6, but jabaco is more powerful.

Thank you very much for your reply. ;)

.

This post has been edited 1 times, last edit by "IAO" (Jun 14th 2013, 4:13am)


theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

4

Thursday, June 27th 2013, 11:58pm

Arrays making always problems on Jabaco.l


Have now seen, that it works like VB6:

This code works:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
Dim a(10) As Integer
a(5) = 3

For i=0 To 10
  System.out.println(a(i))
Next i

Dim b(10,12,17) As Integer

Dim c(5 To 17, 0 To 14, 3 To 6) As Integer

c(1,5,4) =13  'Throws an ArrayIndexOutOfBoundsException
c(6,5,4) =13


Internally

Jabaco Source

1
Dim c(5 To 17, 0 To 14, 3 To 6) As Integer
is compiled to

Jabaco Source

1
2
3
4
VBArrayInteger c = new VBArray();
c.setBound(3, 6, false);
c.addDimension(0, 14, false);
c.addDimension(5, 17, false);


And

Jabaco Source

1
c(6,5,4) =13
is compiled to

Jabaco Source

1
c.getFromDimension(4).getFromDimension(5).setValueInt(6, 13);



And here the one dimensional array:

Jabaco Source

1
2
Dim a(10) As Integer
a(5) = 3
is compilked to

Jabaco Source

1
2
3
VBArrayInteger a = new VBArray();
a.setBound(0, 10, false);
a.setValueInt(5, 3);




Visual Basic.NET on the other side, no longer accept something like

Jabaco Source

1
Dim a(3 to 7) As String
You can still write

Jabaco Source

1
Dim a(0 to 7) String
or

Jabaco Source

1
Dim a(7) As String
But not an Dim a(x to y), where x unequal to zero.

Greatings
theuserbl

IAO

Beginner

  • "IAO" is male
  • "IAO" started this thread

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

5

Saturday, June 29th 2013, 1:11am

Hi...

Is a bit confusing to me, but I will analyze everything.

Thanks mr. theuserbl.

nice days to all..


.

Rate this thread
WoltLab Burning Board