学习笔记,转自:https://stackoverflow.com/questions/13178397/how-to-remove-first-line-of-a-text-file-in-java
public static void removeFirstLine(String fileName) throws IOException { RandomAccessFile raf = new RandomAccessFile(fileName, "rw"); //Initial write position long writePosition = raf.getFilePointer(); raf.readLine(); // Shift the next lines upwards. long readPosition = raf.getFilePointer(); byte[] buff = new byte[1024]; int n; while (-1 != (n = raf.read(buff))) { raf.seek(writePosition); raf.write(buff, 0, n); readPosition += n; writePosition += n; raf.seek(readPosition); } raf.setLength(writePosition); raf.close(); }
相关推荐
The first part of the API is the focus of this course --basically, how to send and receive messages independent of the provider/protocol. * The second part speaks the protocol-specific languages, ...
The benefit of a column maker is that it can help you to format your text/code, or in some cases to make it easier to read in complex nested logic. Quick Open UltraEdit and UEStudio provide multiple ...
Some stupid mail servers put tabs in some fields (CC:, TO:) when they want to make a new line, the correct is to put at least a space in the beginning of the line, added a little code to "...
6 , chunks.zip This will open a file and read it in "Chunks" of a selected file.<END><br>7 , logging.zip This is a bas that will log installation procedures so the file can be removed later....
which allows you to set the format of the log line and put in it any column value you like. * Version 1.76: o Added 'One-Click Tray Icon' option. When it's checked and you use the tray icon ...
How can we use a class Foo in a header file without access to its definition? We can declare data members of type Foo* or Foo&. We can declare (but not define) functions with arguments, and/or ...
winhole.zip This example demonstrates how to put a hole in the center of a form.<END><br>15 , tileform.zip This will tile a picture on the background of your form.<END><br>16 , radiomnu.zip ...
selected, Windows applications to remove the displaying of PRWin98 menus and/or windows. Overview -------- Mask for Windows - PRWin98 provides Microsoft(R) Windows(TM) 3.x users with the ability ...
Before we look at how SQL Server uses and manages its memory, we need to ensure a full understanding of the more common memory related terms. The following definitions will help you understand how SQL...
displays the number of new messages (as msn messenger display messages) and plays a WAV file<END><br>52 , urlhist.zip This sample demonstrates how to loop through the history folder of Internet ...
After you find a framework file you could pull it via adb pull /path/to/file or use a file manager application. After you have the file locally, pay attention to how Apktool installs it. The number ...
1.x/6.0 (Java) <END><br>6 , ocxex.zip "This is a quick example I made to show you how to use Events and properties in a OCX."<END><br>7 , news.exe This control aids as a complete Newsgroup ...
Here is how the properties of a function are assigned in make_function_table(pop_struct *pop): pop[0].function_table[0].arity = 2; pop[0].function_table[0].macro = FALSE; pop[0].function_...
[] 匹配中括号里的内容[a-z][A-Z][0-9]。 ! 事件。 $ 取环境变量的值。 | 管道。把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后...
(modify the file system path of each installation to a different directory so that uploads do not overlap between installations); or, * your site runs a number of web server front-ends behind a ...
Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...
* The command line to invoke a "git cat-file" command from inside "git p4" was not properly quoted to protect a caret and running a broken command on Windows, which has been corrected. * "git ...
In the event of page getting full and reaching the PageItemCount, MGIndex will sort the keys in the page's dictionary and split the data in two pages ( similar to a b+tree split) and update the page ...
Note: There is a slight mirroring lag between when a change is visible on the web in Gerrit and when repo download will be able to find it for all users, because of replication delays to all servers ...