Hi, Jan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, January 28, 2005 12:48 PM
To: [email protected]
Subject: AW: regexp question
Sorry if offtopic, seems to be a more javaspecific question.
actually the value that has to be put in the file is a multiline
property. So i adapted the task to read a property.
Problem, because of multiline :
line 1
line 2
line 3
insert line 1
insert line 2
line 8
line 9
before and after the insert an additional blank line has been put in.
If the property is a oneline property all is fine.
How to get rid of that additional blank lines ?
Gilbert
...
private Project project;
public void setProject(Project proj) {
project = proj;
}
public void execute()
{
String text = project.getProperty("insert");
try
{
LineNumberReader inp =
new LineNumberReader(new
FileReader(inputfile));
BufferedWriter out = new BufferedWriter(new
FileWriter(outputfile));
String line;
while ((line = inp.readLine()) != null)
{
out.write(line);
out.write(System.getProperty("line.separator"));
if (inp.getLineNumber() == after)
{
out.write(text);
out.write(System.getProperty("line.separator"));
}
}
inp.close();
out.close();
...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]