Examples of BackwardsFileStream


Examples of com.googlecode.psiprobe.tools.BackwardsFileStream

                //
                lastKnownLength = 0;
                lines.add(" ------------- THE FILE HAS BEEN TRUNCATED --------------");
            }

            BackwardsFileStream bfs = new BackwardsFileStream(file, currentLength);
            try {
                BackwardsLineReader br = new BackwardsLineReader(bfs);
                long readSize = 0;
                long totalReadSize = currentLength - lastKnownLength;
                String s;
                while (readSize < totalReadSize && (s = br.readLine()) != null) {
                    if (!s.equals("")){
                        lines.addFirst(s);
                        readSize += s.length();
                    } else {
                        readSize++;
                    }
                    if (maxReadLines != 0 && lines.size() >= maxReadLines) {
                        break;
                    }
                }

                if (lastKnownLength != 0 && readSize > totalReadSize) {
                    lines.removeFirst();
                }
            } finally {
                bfs.close();
            }
           
            mv.addObject("lines", lines);
        }
        return mv;
View Full Code Here

Examples of org.jstripe.tomcat.probe.tools.BackwardsFileStream

                    //
                    ff.setLastKnowLength(0);
                    ff.getLines().add(listSize, " ------------- THE FILE HAS BEEN TRUNCATED --------------");
                }

                BackwardsFileStream bfs = new BackwardsFileStream(f, currentLength);
                try {
                    LineReader br = new LineReader(bfs, true);
                    String s;
                    while (readSize < currentLength - ff.getLastKnowLength() && (s = br.readLine()) != null) {
                        if (ff.getLines().size() >= maxLines) {
                            if (listSize > 0) {
                                ff.getLines().remove(0);
                                listSize--;
                            } else {
                                break;
                            }
                        }
                        ff.getLines().add(listSize, s);
                        readSize += s.length();
                        if (ff.getLastKnowLength() == 0 && ff.getLines().size() >= initialLines) break;
                    }

                    if (readSize > currentLength - ff.getLastKnowLength() && listSize > 0) {
                        ff.getLines().remove(listSize-1);
                    }

                    ff.setLastKnowLength(currentLength);
                } finally {
                    bfs.close();
                }
            } else {
                ff.getLines().clear();
            }
            request.getSession(true).setAttribute(fileAttributeName, ff);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.