KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > stefanochizzolini > clown > bytes > IInputStream


1 /*
2   Copyright © 2006 Stefano Chizzolini. http://clown.stefanochizzolini.it
3
4   Contributors:
5     * Stefano Chizzolini (original code developer, info@stefanochizzolini.it):
6       contributed code is Copyright © 2006 by Stefano Chizzolini.
7
8   This file should be part of the source code distribution of "PDF Clown library"
9   (the Program): see the accompanying README files for more info.
10
11   This Program is free software; you can redistribute it and/or modify it under
12   the terms of the GNU General Public License as published by the Free Software
13   Foundation; either version 2 of the License, or (at your option) any later version.
14
15   This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16   WARRANTY, either expressed or implied; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18
19   You should have received a copy of the GNU General Public License along with this
20   Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21
22   Redistribution and use, with or without modification, are permitted provided that such
23   redistributions retain the above copyright notice, license and disclaimer, along with
24   this list of conditions.
25 */

26
27 package it.stefanochizzolini.clown.bytes;
28
29 import java.io.EOFException JavaDoc;
30
31 /**
32   Input stream.
33   <p>Its pivotal concept is the access pointer.</p>
34 */

35 public interface IInputStream
36 {
37   /**
38     Gets the used buffer size.
39   */

40   long getLength(
41     );
42
43   /**
44     Gets the pointer position.
45   */

46   long getPosition(
47     );
48
49   /**
50     Gets the hash representation of the sequence.
51   */

52   int hashCode(
53     );
54
55   /**
56     Reads a sequence of bytes from the stream and advances the position within the stream.
57     @param data Target byte array.
58   */

59   void read(
60     byte[] data
61     )
62     throws EOFException JavaDoc;
63
64   /**
65     Reads a sequence of bytes from the stream and advances the position within the stream.
66     @param data Target byte array.
67     @param offset Location in the byte array at which storing begins.
68     @param length Number of bytes to copy.
69   */

70   void read(
71     byte[] data,
72     int offset,
73     int length
74     )
75     throws EOFException JavaDoc;
76
77   /**
78     Reads a byte from the stream and advances the position within the stream.
79     @return Byte from the stream.
80   */

81   byte readByte(
82     )
83     throws EOFException JavaDoc;
84
85   /**
86     Reads an integer from the stream and advances the position within the stream.
87     @return Integer from the stream.
88   */

89   int readInt(
90     )
91     throws EOFException JavaDoc;
92
93   /**
94     Reads the next line of text.
95     @return String from the stream.
96   */

97   String JavaDoc readLine(
98     )
99     throws EOFException JavaDoc;
100
101   /**
102     Reads a short integer from the stream and advances the position within the stream.
103     @return Short integer from the stream.
104   */

105   short readShort(
106     )
107     throws EOFException JavaDoc;
108
109   /**
110     Reads a string from the stream and advances the position within the stream.
111     @param length Number of bytes to read.
112     @return String from the stream.
113   */

114   String JavaDoc readString(
115     int length
116     )
117     throws EOFException JavaDoc;
118
119   /**
120     Reads an unsigned byte integer from the stream and advances the position within the stream.
121     @return Unsigned byte integer from the stream.
122   */

123   int readUnsignedByte(
124     )
125     throws EOFException JavaDoc;
126
127   /**
128     Reads an unsigned short integer from the stream and advances the position within the stream.
129     @return Unsigned short integer from the stream.
130   */

131   int readUnsignedShort(
132     )
133     throws EOFException JavaDoc;
134
135   /**
136     Sets the pointer absolute position.
137   */

138   void seek(
139     long offset
140     );
141
142   /**
143     Sets the pointer position.
144   */

145   void setPosition(
146     long value
147     );
148
149   /**
150     Sets the pointer relative position.
151   */

152   void skip(
153     long offset
154     );
155
156   /**
157     Gets the buffer data copied to a newly-allocated byte array.
158   */

159   byte[] toByteArray(
160     );
161 }
Popular Tags