Guest User

Untitled

a guest
Jan 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. Sep 20 11:44:10 Updated: krb5-workstation-1.9-33.el6_3.3.x86_64
  2. Sep 20 11:44:11 Updated: qpid-cpp-server-ssl-0.14-22.el6_3.x86_64
  3. Sep 20 11:44:11 Updated: qpid-tools-0.14-6.el6_3.noarch
  4. Sep 21 11:58:30 Updated: libxml2-2.7.6-8.el6_3.3.x86_64
  5. Sep 21 11:58:35 Updated: libxml2-devel-2.7.6-8.el6_3.3.x86_64
  6. Sep 21 11:58:37 Updated: libxml2-python-2.7.6-8.el6_3.3.x86_64
  7. Sep 26 19:01:09 Updated: kernel-firmware-2.6.32-279.9.1.el6.noarch
  8. Sep 26 19:01:21 Installed: kernel-2.6.32-279.9.1.el6.x86_64
  9. Sep 26 19:01:44 Installed: kernel-devel-2.6.32-279.9.1.el6.x86_64
  10. Sep 26 19:01:51 Updated: kernel-headers-2.6.32-279.9.1.el6.x86_64
  11. Sep 26 19:02:12 Updated: google-chrome-stable-22.0.1229.79-158531.x86_64
  12.  
  13. public static void tail(File src, OutputStream out, int maxLines) throws FileNotFoundException, IOException {
  14. BufferedReader reader = new BufferedReader(new FileReader(src));
  15. String[] lines = new String[maxLines];
  16. int lastNdx = 0;
  17. for (String line=reader.readLine(); line != null; line=reader.readLine()) {
  18. if (lastNdx == lines.length) {
  19. lastNdx = 0;
  20. }
  21. lines[lastNdx++] = line;
  22. }
  23.  
  24. OutputStreamWriter writer = new OutputStreamWriter(out);
  25. for (int ndx=lastNdx; ndx != lastNdx-1; ndx++) {
  26. if (ndx == lines.length) {
  27. ndx = 0;
  28. }
  29. writer.write(lines[ndx]);
  30. writer.write("n");
  31. }
  32.  
  33. writer.flush();
  34. }
Add Comment
Please, Sign In to add comment