Skip to content

Commit

Permalink
filter lines server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe.demanget committed Oct 16, 2013
1 parent 4c73ce9 commit eb50b77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 158 deletions.
24 changes: 9 additions & 15 deletions src/main/java/fr/warlog/bus/FileMgt.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.nio.file.Watchable;
import java.nio.file.WatchEvent.Kind;
import java.nio.file.WatchEvent.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipInputStream;

Expand All @@ -28,7 +21,6 @@
import fr.warlog.util.MainUtils;
import fr.warlog.util.StandardException;
import fr.warlog.util.Utils;
import static java.nio.file.StandardWatchEventKinds.*;

/**
* File Management
Expand Down Expand Up @@ -151,27 +143,29 @@ public String readFile( String pMsg ) {
* @param col
* @param sep
*/
public Data<List<Line>> readFileLines( String pMsg , int start, int limit, String sep, int col, String pattern) {
public Data<List<Line>> readFileLines( String pMsg , int start, int limit, String sep, int col, String spattern) {
List<Line> result = new ArrayList<Line>();
Data<List<Line>> dataRes = new Data<List<Line>>(result);
BufferedReader lBis = null;
try {
String line;

if(pMsg.endsWith(".gz")){
GZIPInputStream zipIS = new GZIPInputStream( new FileInputStream( pMsg ));
@SuppressWarnings("resource")
GZIPInputStream zipIS = new GZIPInputStream( new FileInputStream(pMsg));
// ZipEntry nextEntry = zipIS.getNextEntry();
lBis = new BufferedReader( new InputStreamReader( zipIS, "UTF-8" ) );
}else{
lBis = new BufferedReader( new InputStreamReader( new FileInputStream( pMsg ), "UTF-8" ) );
}
boolean doProcess=true;
int total=0;
Pattern pattern = (spattern == null)?null:Pattern.compile(spattern);
while ( ( line = lBis.readLine() ) != null ) {
if(pattern !=null && !line.matches(pattern)){
continue;
if(pattern !=null ){
Matcher matcher = pattern.matcher(line);
if(! matcher.find()) continue;
}

if(start>0){
start--;
}else{
Expand Down
142 changes: 0 additions & 142 deletions src/main/webapp/app/controller/FileController.js.antigitlost.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/webapp/app/view/file/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Ext.define('app.view.file.List' ,{
displayInfo: true}],

columns: [
{header: '', dataIndex: 'id', width:50}
{header: 'line', dataIndex: 'id', width:50}
,{header: 'A', dataIndex: 'col1', flex: 1, renderer: 'htmlEncode'}
// ,{header: 'B', dataIndex: 'col2', flex: 1}
// ,{header: 'C', dataIndex: 'col3', flex: 1}
Expand Down

0 comments on commit eb50b77

Please sign in to comment.