01: /**
02: * Copyright (C) 2006, 2007 David Bulmore, Software Sensation Inc.
03: * All Rights Reserved.
04: *
05: * This file is part of JPersist.
06: *
07: * JPersist is free software; you can redistribute it and/or modify it under
08: * the terms of the GNU General Public License (Version 2) as published by
09: * the Free Software Foundation.
10: *
11: * JPersist is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with JPersist; if not, write to the Free Software Foundation,
18: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19: */package jpersist.interfaces;
20:
21: import java.io.Reader;
22:
23: /**
24: * This interface should be used in place of Reader in your objects,
25: * and is used to handle Reader for PreparedStatement.[get/set]CharacterStream.
26: */
27:
28: public class CharacterStreamAdapter implements CharacterStream {
29: int length;
30: Reader reader;
31:
32: public CharacterStreamAdapter(int length, Reader reader) {
33: this .length = length;
34: this .reader = reader;
35: }
36:
37: /**
38: * Returns the length of data in the stream.
39: * @return the length of data in the stream.
40: */
41:
42: public int getLength() {
43: return length;
44: }
45:
46: /**
47: * Return the InputStream to read from.
48: * @return the InputStream to read from
49: */
50:
51: public Reader getReader() {
52: return reader;
53: }
54: }
|