Inspired by bug #44958 - Record level support for Data Tables. (No formula parser...
[poi.git] / src / java / org / apache / poi / util / FixedField.java
blobefc74e69888750fb5ac565a89835eba15c11f219
2 /* ====================================================================
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================== */
20 package org.apache.poi.util;
22 import org.apache.poi.util.LittleEndian.BufferUnderrunException;
24 import java.io.*;
26 /**
27 * behavior of a field at a fixed location within a byte array
29 * @author Marc Johnson (mjohnson at apache dot org
32 public interface FixedField
35 /**
36 * set the value from its offset into an array of bytes
38 * @param data the byte array from which the value is to be read
40 * @exception ArrayIndexOutOfBoundsException if the offset is out
41 * of the array's valid index range
44 public void readFromBytes(byte [] data)
45 throws ArrayIndexOutOfBoundsException;
47 /**
48 * set the value from an InputStream
50 * @param stream the InputStream from which the value is to be
51 * read
53 * @exception BufferUnderrunException if there is not enough data
54 * available from the InputStream
55 * @exception IOException if an IOException is thrown from reading
56 * the InputStream
59 public void readFromStream(InputStream stream)
60 throws IOException, BufferUnderrunException;
62 /**
63 * write the value out to an array of bytes at the appropriate
64 * offset
66 * @param data the array of bytes to which the value is to be
67 * written
69 * @exception ArrayIndexOutOfBoundsException if the offset is out
70 * of the array's valid index range
73 public void writeToBytes(byte [] data)
74 throws ArrayIndexOutOfBoundsException;
76 /**
77 * return the value as a String
79 * @return the value as a String
82 public String toString();
83 } // end public interface FixedField