Tabular formatter: fix problem with CR (carriage return).
Less command or orher programs shows it as ^M (two characters) and it breaks the table layout – so we need to translate it to a single symbol.
3 * Copyright © 2014 František Kučera (frantovo.cz)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package info.globalcode.jdbc.loopback;
20 import java.sql.SQLException;
21 import java.util.Iterator;
22 import java.util.List;
26 * @author Ing. František Kučera (frantovo.cz)
28 public class ResultSet extends AbstractResultSet {
30 private final ResultSetMetaData metadata;
31 private final Iterator<Object[]> data;
32 private Object[] currentRow;
34 public ResultSet(ResultSetMetaData metadata, List<Object[]> table) {
35 data = table.listIterator();
36 this.metadata = metadata;
40 public boolean next() throws SQLException {
42 currentRow = data.next();
50 public Object getObject(int columnNumber) throws SQLException {
51 return currentRow[columnNumber - 1];
55 public ResultSetMetaData getMetaData() throws SQLException {
60 public void close() throws SQLException {
64 public boolean isClosed() throws SQLException {