file-io

File.lastModified() painfully slow!

我们两清 提交于 2020-01-14 10:21:12
问题 I'm doing a recursive copy of files and like xcopy /D I only want to copy newer files destination files (I cannot use xcopy directly since I need to alter some files in the copy process). In java I use lastModified() to check if the destination file is older than the source file and it's very slow. Can I speed up the process (maybe using JNI??)? Are there any other copy scripts that can do the job better (copy new files + regexp change some text files)? Copying files anyways is not an option

Exception stating “ Resetting to invalid mark ” comes while marking an inputStream and resetting it, for Large files.?

寵の児 提交于 2020-01-14 10:14:27
问题 I am using InputStream object to calculate Md5 of some file. I mark the stream Later I reset the stream. However for large files the following exception comes... inStreamLatestFile.mark(0); checkSumCalculated = MD5CheckSumCalculator.calculateMD5CheckSum(inStreamLatestFile); inStreamLatestFile.reset(); The exception .Md5ValidationAggrStrat ||**Error in calculating checksum:: java.io.IOException: Resetting to invalid mark** ||java.io.IOException: Resetting to invalid mark ||at java.io

Exception stating “ Resetting to invalid mark ” comes while marking an inputStream and resetting it, for Large files.?

一个人想着一个人 提交于 2020-01-14 10:14:05
问题 I am using InputStream object to calculate Md5 of some file. I mark the stream Later I reset the stream. However for large files the following exception comes... inStreamLatestFile.mark(0); checkSumCalculated = MD5CheckSumCalculator.calculateMD5CheckSum(inStreamLatestFile); inStreamLatestFile.reset(); The exception .Md5ValidationAggrStrat ||**Error in calculating checksum:: java.io.IOException: Resetting to invalid mark** ||java.io.IOException: Resetting to invalid mark ||at java.io

Exception stating “ Resetting to invalid mark ” comes while marking an inputStream and resetting it, for Large files.?

蹲街弑〆低调 提交于 2020-01-14 10:13:08
问题 I am using InputStream object to calculate Md5 of some file. I mark the stream Later I reset the stream. However for large files the following exception comes... inStreamLatestFile.mark(0); checkSumCalculated = MD5CheckSumCalculator.calculateMD5CheckSum(inStreamLatestFile); inStreamLatestFile.reset(); The exception .Md5ValidationAggrStrat ||**Error in calculating checksum:: java.io.IOException: Resetting to invalid mark** ||java.io.IOException: Resetting to invalid mark ||at java.io

Strange behavior from .NET regarding file paths

丶灬走出姿态 提交于 2020-01-14 09:15:27
问题 I couldn't find any information on this through professor Google, so here I am. Take the given path name and paste it into Windows Explorer. I stumbled across this after discovering bug in my code that generated the paths with an extra '.' in the path name before a directory \ separator... @"C:\\pathto.\file.ext" In code, .NET will accept the path when calling File.Create and a file will be generated, but at this path: @"C:\\pathto\file.ext" Copying C:\\pathto.\file.ext into Windows Explorer

GWT - RPC - get servlet absolute path to make dir

坚强是说给别人听的谎言 提交于 2020-01-14 09:08:02
问题 I tried to read a file with my "RemoteServiceServlet" but the thing is I want to create a dir which path is related to servlet like absolute_servlet_path/myPackage/ But the problem is... code like ServletContext servletContext = this.getServletContext(); String pathContext = servletContext.getRealPath(""); ... gives not "C:/..." but "/" only so the code cannot be used with java.io.File object. So my question is how can I use java.io.File with RemoteServiceServlet ? 回答1: OK... I had to keep

GWT - RPC - get servlet absolute path to make dir

为君一笑 提交于 2020-01-14 09:07:30
问题 I tried to read a file with my "RemoteServiceServlet" but the thing is I want to create a dir which path is related to servlet like absolute_servlet_path/myPackage/ But the problem is... code like ServletContext servletContext = this.getServletContext(); String pathContext = servletContext.getRealPath(""); ... gives not "C:/..." but "/" only so the code cannot be used with java.io.File object. So my question is how can I use java.io.File with RemoteServiceServlet ? 回答1: OK... I had to keep

Can a char * or char ** masquerade as a FILE *?

拥有回忆 提交于 2020-01-14 08:37:28
问题 In C, I often want to handle data read from a file and data read from an array of strings the same way. Usually reading from a file is for production and from strings is for testing. I wind up writing a lot of code like this: void handle_line(char *line, Things *things) { ... } Things *read_from_chars(char *lines[]) { Things *things = Things_new(); for (int i = 0; lines[i] != NULL; i++) { handle_line(lines[i], things); } return things; } Things *read_from_input(FILE *input) { char *line =

Can't access resource in a JAR on all computers

三世轮回 提交于 2020-01-14 08:35:33
问题 I'm writing an application (specifically a plugin for the Bukkit Minecraft server). Doing this requires that I access a .properties file from the JAR of the application. This is where I encounter a strange problem. When I test the program on my development PC, it runs just fine. The .properties file gets loaded and everything is fine. However, on the other computer that I test it on, I try to start the app, and it can't loaded the properties, and the InputStream is null . Here is the method

Encoding file paths

可紊 提交于 2020-01-14 07:15:08
问题 Is there a built in method in .net for encoding file paths in the same way you would encode a url? For instance, if I have illegal characters in a file name, like "whatever:whatever" I would like it to encode the ":" so it's still there, just encoded so that the system will accept it. I'd like to do something like Path.Encode(fileName) Anything like this out there? Here's what I'm doing. I'm scraping wikipedia.org for a game I've created at www.wikipediamaze.com. When I do the screen scraping