问题标签 [filewriter]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 写入时移动文件?
是否可以在使用 FileWriter 写入文件时移动文件的内容?
我需要将数据常量写入文件的头部,如果这样做,它会覆盖文件。
我应该使用什么技术来做到这一点,或者我应该在每次文件写入时制作文件副本(顶部有新数据)?
java - FileWriter在Java中写入多个文件的问题
我正在使用带有 freemarker 的 java 通过 FTL(模板文件)和 XML 生成 HTML 文件。我在多个文件中得到了结果,但每个文件都包含整个结果。我希望每个文件都包含自己的结果。为了给你更多的细节,看看我的java代码的这一部分:(解决方案应该很简单,但我找不到)
}
谢谢你的帮助。
javascript - 强制下载在 JavaScript 中使用 FileWriter 创建的 blob
HTML5 引入了 FileWriter 类。通过这个类,您可以制作 Blob。(文件是 Blob 的扩展。)使用 JavaScript,您可以创建 Blob,例如使用 dataURL 显示它。
例子:
但这还不够好:) 我希望下载新创建的(文本)文件。不在同一个或单独的窗口中打开。
有办法吗?必须有。如何?
(讨论已经在谷歌浏览器群里了)
更新
文件 API 已更改,因为规范已更改(或其他内容!?)。Webkit 打破了向后兼容BlobBuilder
,现在称为WebKitBlobBuilder
. jsFiddle上的相同示例不同
更新
创建 Blob 现在再次以不同的方式工作(不再append()
):
android - 写入文件的新行
我正在尝试将我的应用程序日志写入文件。我创建了一个在行尾附加一行的方法。
一切正常,少了新的字符线。
我试过使用:
但我一直在一行中得到所有内容:(
有任何想法吗?
java - Java FileWriter 只写第一行
我正在开发一个具有 JTextArea 供用户输入文本的 Java 应用程序。它可以是任意数量的行,但是我的 FileWriter 遇到了问题,它只保存任何输入的第一行。我以前从未使用过 Swing 或 FileWriter,所以我可能弄错了,但这是我的代码:
谢谢!
java - 如何让 Java 每分钟一次将 ArrayList 的内容写入文件?
只是关于上述主题的一个快速问题。基本上,我正在编写一个从网络捕获数据并将其写入外部文件以进行进一步处理的软件。
我想知道的是最好使用什么代码来获得这种预期的效果。
谢谢你的时间
大卫
android - 将文本从 EditText 写入文件 - android
我想将 EditText 中的文本打印到文件中。因此,当用户输入消息并点击提交按钮时,消息将写入文件。
这是我的代码:
应用程序运行得很好,但文件没有被创建!有人可以告诉我有什么问题吗?:)
android - 根据 minSdkVersion 写入文件 - android
我为我的 android 应用程序编写了一个文件编写器。它是在 Galaxy Tab 上运行的,所以我的 minSdkVersion 必须至少为 4,所以它会填满屏幕。我最初从 SdkVersion = 2 开始,那时我的文件编写器工作得很好。将 SdkVersion 更改为 4 引入了问题。我的文件编写器不再工作了!应用程序运行良好,但没有创建文件。
我的 .java 文件如下所示:
}
我的 manifest.xml 看起来像这样:
为什么我的文件编写器不适用于 minSdkVersion > 2?我必须制作一个新的文件编写器吗?或者怎么办?
抱歉代码乱七八糟,我对编程很陌生:)
python - Counting (and writing) word frequencies for each line within text file
first time posting in stack - always found previous questions capable enough of solving my prob! Main problem I have is the logic... even a pseudo code answer would be great.
I'm using python to read in data from each line of a text file, in the format:
Using nltk, I can tokenize by line then can use reader.sents() to iterate through etc:
But I would like to count the frequency of certain 'hot words' (stored in an array or similar) per line, then write them back to a text file. If I used reader.words(), i could count up the frequency of 'hot words' in the entire text, but i'm looking for the amount per line (or 'sentence' in this case).
Ideally, something like:
Also, not so worried about URL becoming broken (using WordPunctTokenizer would remove the punctuation - thats not an issue)
Any useful pointers (including pseudo or links to other similar code) would be great.
---- EDIT ------------------
Ended up doing something like this:
Output is: