ArrayIndexOutOfBoundsException

schimanski

Well-Known Member
Licensed User
Longtime User
I don't know the reason ist for this error. I only want to change signed bytes in unsigned bytes. It works sometimes, and sometimes not...:confused:


B4X:
Dim UKSP_Puffer(100) As Int
Dim Bytes_wandeln As RandomAccessFile

this is the part of the LogCat of the service:

B4X:
UKSP_Puffer(Trennposition)=Bytes_wandeln.ReadUnsignedByte(Trennposition)
java.lang.ArrayIndexOutOfBoundsException
  at anywheresoftware.b4a.randomaccessfile.RandomAccessFile$ByteArrayChannel.read(RandomAccessFile.java:267)
  at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.ReadSignedByte(RandomAccessFile.java:149)
  at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.ReadUnsignedByte(RandomAccessFile.java:141)
  at Foxfinder.Version_0_1.ausgangs._uksp_sammeln(ausgangs.java:447)
.....
...
 

schimanski

Well-Known Member
Licensed User
Longtime User
Hello Erel!

Here some more code:

B4X:
'Servicemodul
Sub Process_Globals
  UKSP_length=0
  Dim UKSP_Puffer_Bytes(100) As Byte
  Dim UKSP_Puffer(100) As Int
  Dim Bytes_wandeln As RandomAccessFile
  Dim filestreamAusgang As AsyncStreams 
...
...

Sub filestreamAusgang_NewData (Buffer() As Byte)   
  UKSP_length=buffer.Length       
  UKSP_Puffer_Bytes=buffer
End Sub

Sub Timer_Tick
  If UKSP_length<>0 Then collect_data
end sub

Sub collect_data
  Bytes_wandeln.Initialize3(UKSP_Puffer_Bytes,False) 

  For Trennposition=0 To UKSP_length
     ...
    ....

Thanks for our help....
 
Upvote 0
Top