简体   繁体   English

如何使用jCIFS使用默认查看器在Android中打开文件

[英]How to open files in Android with default viewer using jCIFS

I'm using the free jCIFS library to connect to my NAS device via CIFS, and it's working great. 我正在使用免费的jCIFS库通过CIFS连接到我的NAS设备,它运行良好。 I can connect and get a list of filenames, etc. without any issues. 我可以连接并获取文件名列表等,没有任何问题。

Now I'd like to open one of the files in the default Android application - ie a music file should be opened in the music player, an image in the gallery, video file in a video player and so forth. 现在我想打开默认Android应用程序中的一个文件 - 即音乐文件应该在音乐播放器中打开,图库中的图像,视频播放器中的视频文件等等。 The issue is not really about getting the MIME type and so on. 问题不在于获取MIME类型等等。 The issue is that I don't want to download the files first, they should be streamed . 问题是我不想先下载文件,应该流式传输

Does anyone know how this can be achieved? 有谁知道如何实现这一目标? I know that CifsManager (another third party application) is capable of doing something similar, but it doesn't use jCIFS and it requires root access to mount drives. 我知道CifsManager(另一个第三方应用程序)能够做类似的事情,但它不使用jCIFS,它需要root权限才能挂载驱动器。 It is essential that my application doesn't require root access. 我的应用程序不需要root访问权限。

You can find the jCIFS library here: http://jcifs.samba.org/ 你可以在这里找到jCIFS库: http//jcifs.samba.org/

You can use the SmbFileInputStream to read the file. 您可以使用SmbFileInputStream来读取文件。
Please go through the documentation jcifs.smb.SmbFileInputStream 请查看文档jcifs.smb.SmbFileInputStream

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM