[fpc-pascal] how to convert JNByteBuffer variable type to type usable by fw.write

Mgr. Janusz Chmiel janusz.chmiel at volny.cz
Mon Aug 26 15:13:04 CEST 2019


Please, does somebody of us know how to write file by using binary mode 
and writing data from The variable which have JNByteBuffer variable type?
What do I had to do so I would be able to write data to The output file 
in binary mode from The variable which have JNByteBuffer variable type? 
Thank you very very much for yours answers.
I Am using fpcJVM Android target. Unfortunately, fw.write expect 
Jlstring. Buffer is live \MP3 stream which is automatically loaded by 
bass.so to The device from The Internet. I want to create record 
function to record live stream and listen it simultaneously at The same 
time. So I do not want to use HTTP or other special library to open next 
standalone media stream to allocate new Internet bandwidth. Do you 
think, that is it possible or I can not create recording feature to 
simply? Many of us may be think, why I Am doing my best to develop my 
own personal little apps by using Pascal and Android. There are so many 
many players on Google Play. I give you The answer.
Professional apps such as Audials, which support recording feature are 
full of amazing features. I can not tell negative word about it. But 
many functions have one disadvantage for Me as visually impaired with no 
sight at all. Many buttons, many GUI controls and orientation inside so 
complex app is not easy. This is The reason why I do my best to develop 
my own little radio player and recorder from scratch. And I have next 
important reason. It is very remarkable opportunity to learn object 
oriented programming, Android API calls, .so libraryes calls and other. 
By The way. I have never found other solution than units for FPCJVM 
Android target, which would allow Me to develop GUI with no need to 
specify object coordinates and positions by using Pixel or other values. 
I do not know about Java Android library which would allow Me to create 
buttons, combo boxes and other elements with no depend on .xml files 
which contain position values and there is other problem. Even if some 
Java language commands can display short warning or other think, there 
is important Czech characters encoding problem. There is no free Lazarus 
compatible library for Windows, which can be really be used without 
typing numbers to specify object values. VCL have been created for 
Delphi and I do not know about legal and opensource alternative to VCL 
for Lazarus for Windows.
So I have decided to program some simple apps for Android. GUI is 
acceptable by sighted users. Sure, may be, that it will be never so nice 
like GUI, which uses Gradle themes and special tricks supported by 
Android studio or Kotlin language. But for Me is very important The 
fact, that GUI can be used not only with screen readers, but it can be 
used by sighted users and I can program without assistance of sighted 
person, who would help Me to tailor GUI by using Mouse and some IDE 
preview feature while developing GUI.
Next factor. FPCJVM compiler enable Pascal programmer to create 
professional apps. It is possible to call .jar libraryes without 
embedded .so libraryes or with embedded ones. Very advanced Pascal 
programmer can even create .so library by using ARM machine code 
compiler target and call those functions from FPCJVM based source code. 
If somebody will improve The quality of javapp.jar, so it will not 
bother because of swing appled when using it from Windows and when 
generating Android import header files, it will be possible to use not 
only newer and newer Android APIS. But it also would be possible to use 
complex projects such as Exoplayer from Google, if somebody would be 
able to compile standalone Exoplayer library without demo apps to 
standalone .jar library and if javapp.jar will be able to create usable 
import headers for it, it will be next multimedia framework for FPCJVM 
Android developers. Since Exoplayer support audio and video, it do not 
depend on native code .so libraryes, it is complex app compiled to 
classes. The question is, if The parts of Exoplayer code have not been 
developed by using Kotlin. If so, may be, that creating new tool to 
generate Pascal import headers from Classes, which have been generated 
by Kotlin compiler would be very very complex task.
Thank you very very much for yours answer on my question.



More information about the fpc-pascal mailing list