- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有两个 AFP文件,我想将它们连接在一起,我该如何完成。我已经编写了 java 代码来连接它们,使用 BufferedInputStream 和 BufferedOutputStream 结果 AFP 格式不正确。我什至尝试使用 linux cat 但产生了相同的错误结果。请帮忙。我不认为问题出在我的 Java 代码上,但我在下面发布了代码以防万一。
注意:一件奇怪的事情是,如果我切换串联的顺序,它就会产生正确的格式输出。例如,如果我先连接 A.afp,然后连接 B.afp,那么输出就会困惑,但如果我连接 B.afp,然后连接 A.afp,那么它会产生正确的格式结果。但是我需要 A.afp 出现在 B.afp 之前
public static void main(String[] args) {
String filePath1 = "C:\\dev\\harry\\ETCC_data\\3199_FI_20_20110901143009.afp";
String filePath2 = "C:\\dev\\harry\\ETCC_data\\3643_FI_49_20110901143006.afp";
ConcatenateMain cm = new ConcatenateMain();
cm.concate(filePath1, filePath2);
}
private void concate(String filePath1, String filePath2){
BufferedInputStream bis1 = null;
BufferedInputStream bis2 = null;
FileInputStream inputStream1 = null;
FileInputStream inputStream2 = null;
FileOutputStream outputStream = null;
BufferedOutputStream output = null;
try{
inputStream1 = new FileInputStream(filePath1);
inputStream2 = new FileInputStream(filePath2);
bis1 = new BufferedInputStream(inputStream1);
bis2 = new BufferedInputStream(inputStream2);
List<BufferedInputStream> inputStreams = new ArrayList<BufferedInputStream>();
inputStreams.add(bis1);
inputStreams.add(bis2);
outputStream = new FileOutputStream("C:\\dev\\harry\\ETCC_data\\output.afp");
output = new BufferedOutputStream(outputStream);
byte [] buffer = new byte[BUFFER_SIZE];
for(BufferedInputStream input : inputStreams){
try{
int bytesRead = 0;
while ((bytesRead = input.read(buffer, 0, buffer.length)) != -1)
{
output.write(buffer, 0, bytesRead);
}
}finally{
input.close();
}
}
}catch(IOException e){
}finally{
try {
output.close();
} catch (IOException e) {
}
}
}
最佳答案
Xenos D2e软件生成的AFP默认在页面顶部包含内嵌资源,像这样
AFP file 1 resources AND AFP file 2 resources
AFP file 1 content AFP file 2 content
但是当我尝试将这两个文件连接在一起时,一些资源将位于连接文件的中间,因此会弄乱结果
AFP file 1 resources
AFP file 1 content
AFP file 2 resources ------> resources should not be in the middle page
AFP file 2 content
所以解决方案是将所有资源导出到外部文件,然后您可以按如下方式连接
AFP file resources
AFP file 1 content
AFP file 2 content
这将解决问题。
关于java - 如何将两个 AFP 文件连接在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7589075/
我使用 java 实用程序合并了三个 AFP 文件,该实用程序从文件中读取字节并使用 FileOutputStream Java 类写入输出流。合并的 AFP 文件看起来不错,但是打开 AFP 文件后
对于AFP条目 Dijkstra's Shortest Path Algorithm ,证明大纲和证明文件都不存在*。不幸的是,我没有找到 IsaMakefile 来在本地构建这些文档。获取这些文件的
我有一个示例 AFP 文件..想从中读取 TLE(标签逻辑元素)以获取某些预定义标签,例如帐号或帐单号,以便我可以将其转换为特定帐单号的 PDF。还有是否有任何公共(public) Java api
我正在尝试将 AFP 打印到 sysout,但 JCL 不知道(也不知道)FORMS 参数。我目前的解决方案是创建动态 JCL 并将其旋转到 INTRDR,但这是一个薄弱的解决方案,因为该工作不受我们
我有两个 AFP文件,我想将它们连接在一起,我该如何完成。我已经编写了 java 代码来连接它们,使用 BufferedInputStream 和 BufferedOutputStream 结果 AF
我想知道是否可以从我的 iPhone 连接到 AFP(Apple 文件协议(protocol))共享。我的 WiFi 网络中有一个共享,并且想从我的 iPhone 浏览和读取该共享上的文件。 有没有办
我编写了一个应用程序来将一些文件复制到某个位置。它允许用户选择始终位于 AFP 共享上的目的地。这是通过 NSOpenPanel 完成的。返回的 URL 为:file://localhost/Volu
在命令行中,我需要列出本地网络上给定服务器的所有可用 AFP 共享。 我可以浏览提供 AFP 的可用服务器,如下所示: iMac:bin me$ dns-sd -B _afpovertcp._tcp
任何人都可以帮助从 AFP 文件的“字体模式 (FNG)”字段获取文本。是否有任何库(最好是 Java)可以用于此任务? 谢谢, 最佳答案 您可以尝试afplib 。它有一些转储所有结构化字段的示例代
我正在尝试通过 OSX 上的 Java 6 跨安装点获取文件锁: private void tryLockThroughShare() { String path = "/Vo
我正在寻找一个 Java API,它提供将 AFP(IBM 高级功能演示)格式的文档转换为 xml 或 pdf 的功能。我正在尝试实现 Apache FOP 1.1,但几乎没有关于 AFP 的实现文档
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 10年前关闭。 Improve this qu
我使用嵌入式 FOP Trunk 创建了一个 AFP 文件。由于FOP Trunk不支持直接在root下的无操作标签,我需要修改创建的文件以添加NOP记录作为文件中的第一条记录。如何做到这一点? 最佳
使用 python (2.7.3) 在挂载的 afp 卷上写入是否存在已知问题? >f = open("/mnt/foo/test.txt","w+"); 这导致 Traceback (most re
我正在开发一个需要将文件传输到 AFP 卷的应用程序 - 理想情况下,它不会在 OSX 上安装该卷,因为它确实没有必要。 查看 AFP 协议(protocol)内容,我发现了一个旧的 Carbon 头
我有一个在 OSX 上运行的 bash 脚本。 它需要操作网络共享上的一些文件(Synology NAS 上的 AFP 共享)。 不幸的是,脚本运行时有时仍在写入这些文件。 如何确定文件是否正在使用?
我目前正在开发 tvOS/iPhone 应用程序。目标是浏览我的本地网络并找到发布 AFP 和 SMB 共享的不同设备,并从中读取文件。 到目前为止,我已经使用 NSNetServiceBrowser
在 Mac 上,我有一个共享文件夹 ~\Documents。有两个子文件夹:Data 和 Data_2011,前者包含过去几年的文件文件夹,后者包含指向 Data 文件夹中自 2011 年 1 月 1
我是一名优秀的程序员,十分优秀!