MATSIM
Public Member Functions | Private Attributes | List of all members
org.matsim.pt.counts.SimpleWriter Class Reference
Inheritance diagram for org.matsim.pt.counts.SimpleWriter:
Inheritance graph
[legend]

Public Member Functions

 SimpleWriter (final String outputFilename)
 
void write (char[] c)
 
void write (char c)
 
void write (String s)
 
void write (Object o)
 
void writeln (String s)
 
void writeln (Object o)
 
void writeln ()
 
void close ()
 
void flush ()
 
void writeln (StringBuffer line)
 

Private Attributes

final BufferedWriter writer
 

Detailed Description

a small and simple writer, in order to avoid copious "try" and "catch" for "Exception"

Author
yChen

Definition at line 37 of file SimpleWriter.java.

Constructor & Destructor Documentation

◆ SimpleWriter()

org.matsim.pt.counts.SimpleWriter.SimpleWriter ( final String  outputFilename)

Definition at line 41 of file SimpleWriter.java.

References org.matsim.core.utils.io.IOUtils.getBufferedWriter().

41  {
42  writer = IOUtils.getBufferedWriter(outputFilename);
43  }
Here is the call graph for this function:

Member Function Documentation

◆ write() [1/4]

void org.matsim.pt.counts.SimpleWriter.write ( char []  c)

Definition at line 45 of file SimpleWriter.java.

Referenced by org.matsim.pt.counts.PtCountSimComparisonTableWriter.write(), org.matsim.pt.counts.SimpleWriter.write(), org.matsim.pt.counts.OccupancyAnalyzer.write(), and org.matsim.pt.counts.SimpleWriter.writeln().

45  {
46  if (writer != null)
47  try {
48  writer.write(c);
49  } catch (IOException e) {
50  throw new UncheckedIOException(e);
51  }
52  }

◆ write() [2/4]

void org.matsim.pt.counts.SimpleWriter.write ( char  c)

Definition at line 54 of file SimpleWriter.java.

54  {
55  if (writer != null)
56  try {
57  writer.write(c);
58  } catch (IOException e) {
59  throw new UncheckedIOException(e);
60  }
61  }

◆ write() [3/4]

void org.matsim.pt.counts.SimpleWriter.write ( String  s)

Definition at line 63 of file SimpleWriter.java.

63  {
64  if (writer != null) {
65  try {
66  writer.write(s);
67  } catch (IOException e) {
68  System.err.println("writer was not initialized yet!");
69  throw new UncheckedIOException(e);
70  }
71  }
72  }

◆ write() [4/4]

void org.matsim.pt.counts.SimpleWriter.write ( Object  o)

Definition at line 74 of file SimpleWriter.java.

References org.matsim.pt.counts.SimpleWriter.write().

74  {
75  write(o.toString());
76  }
Here is the call graph for this function:

◆ writeln() [1/4]

void org.matsim.pt.counts.SimpleWriter.writeln ( String  s)

Definition at line 78 of file SimpleWriter.java.

References org.matsim.pt.counts.SimpleWriter.write().

Referenced by org.matsim.pt.counts.OccupancyAnalyzer.write().

78  {
79  write(s + "\n");
80  }
Here is the call graph for this function:

◆ writeln() [2/4]

void org.matsim.pt.counts.SimpleWriter.writeln ( Object  o)

Definition at line 82 of file SimpleWriter.java.

References org.matsim.pt.counts.SimpleWriter.write().

82  {
83  write(o + "\n");
84  }
Here is the call graph for this function:

◆ writeln() [3/4]

void org.matsim.pt.counts.SimpleWriter.writeln ( )

Definition at line 86 of file SimpleWriter.java.

References org.matsim.pt.counts.SimpleWriter.write().

Referenced by org.matsim.pt.counts.SimpleWriter.writeln().

86  {
87  write('\n');
88  }
Here is the call graph for this function:

◆ close()

void org.matsim.pt.counts.SimpleWriter.close ( )

Definition at line 91 of file SimpleWriter.java.

Referenced by org.matsim.pt.counts.PtCountSimComparisonTableWriter.write(), and org.matsim.pt.counts.OccupancyAnalyzer.write().

91  {
92  try {
93  writer.close();
94  } catch (IOException e) {
95  throw new UncheckedIOException(e);
96  }
97  }

◆ flush()

void org.matsim.pt.counts.SimpleWriter.flush ( )

Definition at line 100 of file SimpleWriter.java.

100  {
101  try {
102  writer.flush();
103  } catch (IOException e) {
104  throw new UncheckedIOException(e);
105  }
106  }

◆ writeln() [4/4]

void org.matsim.pt.counts.SimpleWriter.writeln ( StringBuffer  line)

Definition at line 108 of file SimpleWriter.java.

References org.matsim.pt.counts.SimpleWriter.writeln().

108  {
109  writeln(line.toString());
110  }
Here is the call graph for this function:

Member Data Documentation

◆ writer

final BufferedWriter org.matsim.pt.counts.SimpleWriter.writer
private

Definition at line 39 of file SimpleWriter.java.


The documentation for this class was generated from the following file: