- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想发送图片文件(jpg、png)到NAS server在java中使用smb
我添加了 jcifs-1.3.19.jar 。如前所述here和 here
编辑:我已经使用此代码成功将jpeg图像发送到服务器上的共享文件夹,但速度非常慢,发送几乎1kb/秒。有什么解决办法吗??
static final String USER_NAME = "Waqas";
static final String PASSWORD = "mypass";
static final String NETWORK_FOLDER = "smb://DESKTOP-LAP/Users/Waqas/";
public boolean copyFiles(FileInputStream file, String fileName) {
boolean successful = false;
int cursor;
SmbFileOutputStream sfos;
SmbFile sFile;
String path;
NtlmPasswordAuthentication auth;
try{
String user = USER_NAME + ":" + PASSWORD;
auth = new NtlmPasswordAuthentication(user);
StrictMode.ThreadPolicy tp = StrictMode.ThreadPolicy.LAX; StrictMode.setThreadPolicy(tp);
path = NETWORK_FOLDER + fileName;
sFile = new SmbFile(path, auth);
sfos = new SmbFileOutputStream(sFile);
while((cursor = file.read())!=-1){
sfos.write(cursor);
}
successful = true;
System.out.println("Successful " + successful);
}
catch (Exception e) {
successful = false;
e.printStackTrace();
}
return successful;
}
最佳答案
最后是解决方案:
public boolean copyFiles(FileInputStream file, String fileName) {
boolean successful = false;
int cursor;
SmbFileOutputStream sfos;
SmbFile sFile;
String path;
NtlmPasswordAuthentication auth;
try{
String user = USER_NAME + ":" + PASSWORD;
System.out.println("User: " + user);
auth = new NtlmPasswordAuthentication(user);
StrictMode.ThreadPolicy tp = StrictMode.ThreadPolicy.LAX; StrictMode.setThreadPolicy(tp);
path = NETWORK_FOLDER + fileName+".jpeg";
System.out.println("Path: " +path);
sFile = new SmbFile(path, auth);
sfos = new SmbFileOutputStream(sFile);
long t0 = System.currentTimeMillis();
byte[] b = new byte[8192];
int n, tot = 0;
Log.d("asdf","initiating : total="+tot);
while((n = file.read(b))>0){
sfos.write( b, 0, n );
tot += n;
Log.d("asdf","writing : total="+tot);
}
successful = true;
Log.d("asdf","Successful : total="+tot);
}
catch (Exception e) {
successful = false;
e.printStackTrace();
Log.d("asdf","exxeption ");
}
return successful;
}
关于java - 如何在我的应用程序中将图像文件发送到 NAS 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47961360/
我是 Synology 的新手。我想要访问我的 Synology NAS 驱动器。我遵循 Synology_Download_Station_Official_API。 我阅读了基本工作示例以获取 A
我在两个联合的列中有 NA。在合并之前,我使用 str_to_title 来创建值的一致性。 问题是现在 NA 未注册为 NA,它们已合并为字符串。 IE。 City State
我有一个数据框,例如: Groups Event Value G1 1 Canidae G1 1 Canidae G1 1 Felidae G1
我想问一下,我有一个非公共(public)IP,位于NAT后面。我想从互联网访问我的家庭 Synology 服务器,但我无法使用 ssh 隧道。 是否有关于在 Synology NAS 服务器上安装
是否有人试图在 NAS 服务器上运行 PostgreSQL 服务器并挂载数据文件?您能否分享一下您是否遇到了一些性能问题或其他问题? 最佳答案 https://www.postgresql.org/d
我试图让我的 NAS 服务器在用户访问 NAS 时从 S3 sleep 状态唤醒。我想这样做是为了延长服务器的使用生命周期,同时限制其用电量。我见过有人寻求类似的建议,但我发现没有一个提供可靠的解决方
synology NAS 一:这步操作的前提是,你已经可以通过使用软件(Assistant)找到你网络中的NAS设备。接下来我们来安装DSM系统。 二:启动你的Assistant软件,点击搜索。
我正在运行以下代码: unique(is.na(mydataframe$var1)) #FALSE anyNA(mydataframe$var1) #FALSE mydataframe$var1
这个问题在这里已经有了答案: R `Inf` when it has class `Date` is printing `NA` (1 个回答) 3年前关闭。 我试图找出处理 Postgresql 表
我有一个包含用户信息的 data.frame,但每个用户 ID 可能有也可能没有重复的行,并且不同变量中存在相当多的缺失数据。我想做的是删除重复的用户数据,但对于每个用户,我想保留行中包含最少缺失值的
我正在尝试将存储卷安装到容器内。就像 linux 我给了下面的命令 **mount 10.#.##.###:/nvol1 /tmp** 这会产生“访问被拒绝”错误,我已将容器和主机 IP 添加到存储中
我想从大型数据框中删除“FALSE”和“NAs”。我的输入看起来像, 身份证代码1正确2不适用3错误4正确 我需要的输出是, 身份证代码1正确4正确 请建议在 R 中执行此操作的最佳方法谢谢 最佳答案
我正在尝试将文件压缩到Synology NAS(进入/ tmp目录)中。从我的Ubuntu计算机的命令行执行此操作可以按预期进行。运行PHP代码可以在常规Linux发行版上正常运行(就像我尝试过的每个
我试图找到一种简单的方法来计算数据框列中的非缺失案例。我已经使用了这个功能: foo<- function(x) { sum(!is.na(x)) } 然后通过 sapply() 将其应用到数据框 s
我想从大型数据框中删除“FALSE”和“NAs”。我的输入看起来像, 身份证代码1正确2不适用3错误4正确 我需要的输出是, 身份证代码1正确4正确 请建议在 R 中执行此操作的最佳方法谢谢 最佳答案
谁知道nas.sql表的这个字段的作用? ports int(5) server varchar(64) community varchar(50) 我认为社区用于 checkrad snmp 检查,
目前我的老板要求我的团队将我们的数据库迁移到云服务器(Windows)。除此之外,他还要求我们将 SAN/NAS 存储连接到该服务器,以获得更好的速度/性能。问题是我们没有SAN/NAS存储经验。 问
我是 swift 的新手,我试图找出如何从 NAS 服务器检索目录列表到我的应用程序中。 NAS 服务器、MAC 和 iPAD 在我的局域网中。 我确实搜索了那个问题,但找不到任何提示,而且我几天以来
我想编写一个服务器,从 NAS 读取文件并将其发送出去一个 socket 。最快的方法是什么? 谢谢! 最佳答案 我认为标准 CIFS 挂载支持文件上的 mmap(2)(如果我没看错,direct m
我想发送图片文件(jpg、png)到NAS server在java中使用smb 我添加了 jcifs-1.3.19.jar 。如前所述here和 here 编辑:我已经使用此代码成功将jpeg图像发送
我是一名优秀的程序员,十分优秀!