View Javadoc

1   /*
2   
3       dsh-timer  Timer with nanosecond resolution and summary statistics
4       on recorded elapsed times.
5       Copyright (c) 2004-2013 held jointly by the individual authors.
6   
7       This library is free software; you can redistribute it and/or modify it
8       under the terms of the GNU Lesser General Public License as published
9       by the Free Software Foundation; either version 3 of the License, or (at
10      your option) any later version.
11  
12      This library is distributed in the hope that it will be useful, but WITHOUT
13      ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
14      FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15      License for more details.
16  
17      You should have received a copy of the GNU Lesser General Public License
18      along with this library;  if not, write to the Free Software Foundation,
19      Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
20  
21      > http://www.fsf.org/licensing/licenses/lgpl.html
22      > http://www.opensource.org/licenses/lgpl-license.php
23  
24  */
25  package org.dishevelled.timer;
26  
27  import java.io.File;
28  import java.io.IOException;
29  import java.io.OutputStream;
30  
31  import java.util.Map;
32  
33  /**
34   * Timer report.
35   */
36  public interface TimerReport
37  {
38  
39      /**
40       * Append the specified map of timers keyed by runnables to the specified appendable.
41       *
42       * @param <T> extends Appendable
43       * @param timers map of timers keyed by runnables to append, must not be null
44       * @param appendable appendable to append the specified map of timers keyed by runnables to, must not be null
45       * @return the specified appendable with the specified map of timers keyed by runnables appended
46       * @throws IOException if an IO error occurs
47       */
48      <T extends Appendable> T append(Map<? extends Runnable, Timer> timers, T appendable) throws IOException;
49  
50      /**
51       * Write the specified map of timers keyed by runnables to the specified file.
52       *
53       * @param timers map of timers keyed by runnables to append, must not be null
54       * @param file file to write to, must not be null
55       * @throws IOException if an IO error occurs
56       */
57      void write(Map<? extends Runnable, Timer> timers, File file) throws IOException;
58  
59      /**
60       * Write the specified map of timers keyed by runnables to the specified output stream.
61       *
62       * @param timers map of timers keyed by runnables to append, must not be null
63       * @param outputStream output stream to write to, must not be null
64       * @throws IOException if an IO error occurs
65       */
66      void write(Map<? extends Runnable, Timer> timers, OutputStream outputStream) throws IOException;
67  }