Package org.jstripe.tomcat.probe.tools

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

Related Classes of org.jstripe.tomcat.probe.tools.BackwardsFileStream

Copyright © 2018 www.massapicom. 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.