56 |
56 |
import java.util.List;
|
57 |
57 |
import java.util.Map;
|
58 |
58 |
|
|
59 |
import org.txm.core.messages.TXMCoreMessages;
|
59 |
60 |
import org.txm.core.results.Parameter;
|
60 |
61 |
import org.txm.core.results.TXMParameters;
|
61 |
62 |
import org.txm.core.results.TXMResult;
|
... | ... | |
493 |
494 |
return false;
|
494 |
495 |
}
|
495 |
496 |
|
496 |
|
/**
|
497 |
|
* Write all the lines in a file.
|
498 |
|
*
|
499 |
|
* @param outfile the outfile
|
500 |
|
* @param encoding the encoding
|
501 |
|
* @return true, if successful
|
502 |
|
*/
|
|
497 |
@Deprecated
|
503 |
498 |
public boolean toTxt(File outfile, String encoding) {
|
504 |
|
|
505 |
499 |
return toTxt(outfile, encoding, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
506 |
500 |
}
|
507 |
501 |
|
508 |
|
/**
|
509 |
|
* Write all the lines in a file.
|
510 |
|
*
|
511 |
|
* @param outfile the outfile
|
512 |
|
* @param encoding the encoding
|
513 |
|
* @param colseparator the colseparator
|
514 |
|
* @param txtseparator the txtseparator
|
515 |
|
* @return true, if successful
|
516 |
|
*/
|
|
502 |
@Override
|
|
503 |
@Deprecated
|
517 |
504 |
public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
|
518 |
505 |
try {
|
519 |
506 |
// NK: writer declared as class attribute to perform a clean if the operation is interrupted
|
520 |
|
this.writer = new BufferedWriter(new OutputStreamWriter(
|
521 |
|
new FileOutputStream(outfile), encoding));
|
|
507 |
this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), encoding));
|
522 |
508 |
// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
|
523 |
509 |
toTxt(writer, 0, lines.size() - 1, colseparator, txtseparator);
|
524 |
510 |
} catch (Exception e) {
|
525 |
|
System.err.println(ReferencerCoreMessages.referencerExportFailedDDot + Log.toString(e));
|
|
511 |
Log.severe(TXMCoreMessages.bind(ReferencerCoreMessages.referencerExportFailedDDot, Log.toString(e)));
|
526 |
512 |
return false;
|
527 |
513 |
}
|
528 |
514 |
return true;
|
529 |
515 |
}
|
530 |
516 |
|
531 |
|
/**
|
532 |
|
* Write the lines between from and to in a writer.
|
533 |
|
*
|
534 |
|
* @param writer Where to write the lines
|
535 |
|
* @param from The first line to be written
|
536 |
|
* @param to The last line to be writen
|
537 |
|
* @param colseparator the colseparator
|
538 |
|
* @param txtseparator the txtseparator
|
539 |
|
* @throws CqiClientException the cqi client exception
|
540 |
|
* @throws IOException Signals that an I/O exception has occurred.
|
541 |
|
*/
|
|
517 |
@Deprecated
|
542 |
518 |
public void toTxt(Writer writer, int from, int to, String colseparator, String txtseparator)
|
543 |
519 |
throws CqiClientException, IOException {
|
544 |
520 |
try {
|
545 |
521 |
getLines(0, 9999999);
|
546 |
|
writer.write(pProperty.getName()+colseparator+this.pPattern+"\n"); //$NON-NLS-1$
|
|
522 |
writer.write(pProperty.getName() + colseparator + this.pPattern + "\n"); //$NON-NLS-1$
|
547 |
523 |
for (Line line : lines) {
|
548 |
524 |
writer.write(txtseparator+line.getPropValue().replace(txtseparator, txtseparator+txtseparator)+txtseparator+ colseparator + txtseparator+ line.getReferences().toString().replace(txtseparator, txtseparator+txtseparator)+txtseparator+"\n"); //$NON-NLS-1$
|
549 |
525 |
writer.flush();
|