Blackberry Api:将字节数组写入文件
我正在尝试从 mp3 文件读取和写入元数据。我可以读取数据,但不知道如何写入。
我使用以下代码来获取文件访问权限:
FileConnection file = (FileConnection) Connector.open("file:///store/home/user/music/song.mp3");
if(file.exists())
java.io.InputStream inputStream = file.openInputStream();
稍后,我使用以下代码读取数据:
buffer = new byte[length]; // length is predetermined earlier
if (inputStream.read(buffer, 0, length) == length)
String info = new String((buffer));
如何将数据(字节)写入文件中的指定位置?我不确定输出字节所需的 IO 声明和特定代码。
I am trying to read and write metadata to/from an mp3 file. I can read the data, but I cannot figure out how to write it.
I use the following code to get file access:
FileConnection file = (FileConnection) Connector.open("file:///store/home/user/music/song.mp3");
if(file.exists())
java.io.InputStream inputStream = file.openInputStream();
Later, I read the data using the following code:
buffer = new byte[length]; // length is predetermined earlier
if (inputStream.read(buffer, 0, length) == length)
String info = new String((buffer));
How do I write data (bytes) to the a designated location in the file? I am unsure of both the IO declarations and the specific code required to output my bytes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在 Blackberry 上写入文件,请使用以下代码:
To write a file on Blackberry use the following code: