stream 相关问题

流是一系列可以以串行方式访问的数据元素。对于Java 8的新Stream API,请改用java-stream标签。

如何在不等待获取结束的情况下将响应写入流?

我需要获取音频文件并写入目录。我担心我必须等待获取结束才能下载所有文件,然后写入/保存到文件。可以获取音频吗...

回答 1 投票 0

如何通过 Unix Domain 套接字正确实现 Node.js 通信?

我正在调试多线程 Node.js 实例之间的 IPC 实现。 由于本机不支持数据报套接字,因此我使用默认的流协议,具有简单的应用程序级别

回答 1 投票 0

使用 Express 传输结果时获取连接超时

我们使用以下代码将查询结果流式传输回客户端: app.get('/events', (req, res) => { 尝试 { const 流 = db('事件') 。选择('*') .where({ id_use...

回答 1 投票 0

如何将字符串数组的可选值转换为字符串的可选值?

我很难找到一种优雅的方法将Optional类型的变量转换为Optional并连接给定数组的所有元素。 有没有一个优雅的解决方案...

回答 1 投票 0

如何在不影响磁盘的情况下开始下载并呈现响应?

所以我在 django 中有一个科学数据 Excel 文件验证表单,效果很好。它迭代地工作。用户可以在积累添加到研究中的新数据时上传文件。

回答 1 投票 0

颜色阈值JS、平均图像颜色检测JS

我观看了以下教程 https://youtu.be/BTWPDboW38o?si=_21TOjCfrXC3VWIL 并尝试了相同的操作。我期望的是,我想根据 v 的颜色更改文档的背景颜色...

回答 1 投票 0

Python TCP 服务器使用异步流(独立)发送和/或接收数据?

我有一个使用 asyncio 的基于 python 的 TCP 服务器,但它有一个特定的行为:TCP 客户端(PLC)连接到应用程序,但实际上服务器或客户端都可以启动数据流。一旦...

回答 1 投票 0

PHP:如何从块下载的流请求中获取内容长度

我正在尝试分块下载外部站点档案,但这种方法的问题是,当我尝试通过 get_headers() 获取 Content-Length 时,它不存在。 有人发现这个项目...

回答 1 投票 0

使用 Java Graph SDK 使用 PipedStream 将文件上传到 SharePoint 会导致错误“Content-Range 标头丢失或格式错误”

正如标题所说,我正在尝试将生成的大量内存文件上传到 SharePoint。为了节省内存,我尝试使用 PipedStream 上传它,但由于这个原因我有一个例外: com.microsoft.g...

回答 1 投票 0

如何处理 NodeJS 流中的错误?

我正在尝试找到一种方法,当数据无效时在可读流中发送 NestJS HTTP 错误: 溪流 .pipe(csv()) .on('数据', (数据) => { 尝试 {

回答 1 投票 0

c# GPG 压缩并加密文件流

我需要对文件流进行 ZIP 和 GPG 加密。 然后通过SFTP上传。 我正在使用 Zip Archive 来创建条目。 我正在使用 GPG 进行加密,starksoft.aspen Nuget。 在这里获取本地文件流和

回答 1 投票 0

流中的高效字符串替换

我需要替换流式http响应中的字符串。这样做的天真的方法是 使用 var reader = new StreamReader(input, leftOpen: true); var 原始 = 等待 reader.ReadToEndAsync...

回答 1 投票 0

在 Java 8 中使用多个字段进行分组和计数

我在数据库中有一个 Person 表,关联的域类如下所示: 公共类人{ 私有字符串名字; 私有字符串第二名; 私有字符串引用...

回答 1 投票 0

Python:从 Minio 对象创建 Zip 文件会导致每个文件出现重复条目

在我的应用程序中,我需要从 Minio 存储中获取文件并从中创建一个 Zip 文件。有些文件可能非常大,所以我尝试将它们分块写入,以便能够更好地处理该过程

回答 1 投票 0

如何实现动态运行时查询来过滤java对象流

假设我有以下对象列表 公共类员工{ 私有字符串 emplId; 私人姓名名称; 私人字符串部门; 私人字符串城市; } 并且有 列表 假设我有以下对象列表 public class Employee { private String emplId; private Name name; private String dept; private String city; } 并且有 List<Employee> empLst = Arrays.asList( new Employee("1", "henry", "10", "Boston"), new Employee("2", "Foster", "10", "san jose"), new Employee("3", "Rick", "10", "sfo"), new Employee("4", "Ban", "20", "Boston"), new Employee("5", "Zen", "20", "Ale"), new Employee("6", "Ken", "30", "sfo") ); 如何实现接受员工对象并过滤与查询对象值匹配的列表的搜索 GetEmplList(new Employee().setCity("Boston")) which returns both #1 and #4 employees where as GetEmplList(new Employee().setCity("Boston").setDept("20")) returns only #4 employee GetEmplList(new Employee().setName("Ken")) returns only #6 employees empLst.stream() .filter(e -> e.getCity().equalsIgnoreCase("Boston")) .forEach(e -> System.out.println(e.getName())); 不想要像上面编译时过滤器那样的东西` 您需要一个 Predicate 将元素与提供的“示例”相匹配。示例中为 null 的属性应视为匹配。 public class MatchByExample implements Predicate<Employee> { private final Employee example; public MatchByExample(Employee example) { this.example = example; } @Override public boolean test(Employee employee) { return match(example.getEmplId(), employee.getEmplId()) && match(example.getCity(), employee.getCity()) && match(example.getName(), employee.getName()) && match(example.getDept(), employee.getDept()); } private static boolean match(Object exampleProperty, Object propertyToTest) { if (exampleProperty == null) { //property not provided in example return true; } return exampleProperty.equals(propertyToTest); } } 用途: Employee example = new Employee(null, null, "20", "Boston"); List<Employee> filteredResult = empLst.stream() .filter(new MatchByExample(example)) .toList(); System.out.println(filteredResult); //prints the employee with id 4

回答 1 投票 0

如何实现像过滤java对象流这样的运行时查询

假设我有以下对象列表 公共类员工{ 私有字符串 emplId; 私人姓名名称; 私人字符串部门; 私人字符串城市; } 并且有 列表 假设我有以下对象列表 public class Employee { private String emplId; private Name name; private String dept; private String city; } 并且有 List<Employee> empLst = Arrays.asList( new Employee("1", "henry", "10", "Boston"), new Employee("2", "Foster", "10", "san jose"), new Employee("3", "Rick", "10", "sfo"), new Employee("4", "Ban", "20", "Boston"), new Employee("5", "Zen", "20", "Ale"), new Employee("6", "Ken", "30", "sfo") ); 如何实现接受员工对象并过滤与查询对象值匹配的列表的搜索 GetEmplList(new Employee().setCity("Boston")) which returns both #1 and #4 employees where as GetEmplList(new Employee().setCity("Boston").setDept("20")) returns only #4 employee GetEmplList(new Employee().setName("Ken")) returns only #6 employees empLst.stream() .filter(e -> e.getCity().equalsIgnoreCase("Boston")) .forEach(e -> System.out.println(e.getName())); 不想要像上面编译时过滤器那样的东西` 您需要一个 Predicate 将元素与提供的“示例”相匹配。示例中为 null 的属性应视为匹配。 public class MatchByExample implements Predicate<Employee> { private final Employee example; public MatchByExample(Employee example) { this.example = example; } @Override public boolean test(Employee employee) { return match(example.getEmplId(), employee.getEmplId()) && match(example.getCity(), employee.getCity()) && match(example.getName(), employee.getName()) && match(example.getDept(), employee.getDept()); } private static boolean match(Object exampleProperty, Object propertyToTest) { if (exampleProperty == null) { //property not provided in example return true; } return exampleProperty.equals(propertyToTest); } } 用途: Employee example = //create the example to match by List<Employee> filteredResult = empLst.stream() .filter(new MatchByExample(example)) .toList(); System.out.println(filteredResult);

回答 1 投票 0

将文件保存到 GCS 在 Next.js 生产版本中不起作用

这些是我正在使用的模块。 “@google-cloud/storage”:“^7.7.0” “下一个”:“14.1.0” 这是代码。 “使用服务器”; 从“@

回答 1 投票 0

Arch 测试失败 STANDARD_STREAMS

我有遵循 archunit 规则的应用程序,我得到: NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS 规则失败 - 这意味着我无法使用标准 Java I/O 流。但我可以用什么来代替呢? 我怎样才能

回答 2 投票 0

Struts2 链接打开文件仅适用于 IE

我的页面上有一个打开 PDF 文件的链接,该文件在 IE11 下工作正常,但 Firefox 给我一个“损坏的内容错误”,Chrome 给我一个“从服务器收到的重复标头”错误。 js...

回答 1 投票 0

使用 Java gRPC 库从 Clojure 使用 SpiceDB LookupResources gRPC 流

LookupResources 的 SpiceDB gRPC 端点返回带有游标的资源 ID 的 gRPC 流。 从 Clojure 使用 gRPC 流可能会很困难。我知道我需要具体化 StreamObserver 并消费...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.