KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > util > FixedField


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.util;
20
21 import org.apache.poi.util.LittleEndian.BufferUnderrunException;
22
23 import java.io.*;
24
25 /**
26  * behavior of a field at a fixed location within a byte array
27  *
28  * @author Marc Johnson (mjohnson at apache dot org
29  */

30
31 public interface FixedField
32 {
33
34     /**
35      * set the value from its offset into an array of bytes
36      *
37      * @param data the byte array from which the value is to be read
38      *
39      * @exception ArrayIndexOutOfBoundsException if the offset is out
40      * of the array's valid index range
41      */

42
43     public void readFromBytes(byte [] data)
44         throws ArrayIndexOutOfBoundsException JavaDoc;
45
46     /**
47      * set the value from an InputStream
48      *
49      * @param stream the InputStream from which the value is to be
50      * read
51      *
52      * @exception BufferUnderrunException if there is not enough data
53      * available from the InputStream
54      * @exception IOException if an IOException is thrown from reading
55      * the InputStream
56      */

57
58     public void readFromStream(InputStream stream)
59         throws IOException, BufferUnderrunException;
60
61     /**
62      * write the value out to an array of bytes at the appropriate
63      * offset
64      *
65      * @param data the array of bytes to which the value is to be
66      * written
67      *
68      * @exception ArrayIndexOutOfBoundsException if the offset is out
69      * of the array's valid index range
70      */

71
72     public void writeToBytes(byte [] data)
73         throws ArrayIndexOutOfBoundsException JavaDoc;
74
75     /**
76      * return the value as a String
77      *
78      * @return the value as a String
79      */

80
81     public String JavaDoc toString();
82 } // end public interface FixedField
83

84
Popular Tags