org.apache.commons.flatfile
Interface Entity

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
EntityCollection, IndexedEntityCollection, NamedEntityCollection
All Known Implementing Classes:
DynamicField, EntityArray, EntityCollectionSupport, EntityMap, EntitySupport, Field, FieldSupport, InputFilteringDynamicField, PadJustifyFieldSupport

public interface Entity
extends Cloneable, Serializable

Represents a record or field.

Version:
$Revision: 758023 $ $Date: 2009-03-24 16:09:19 -0500 (Tue, 24 Mar 2009) $

Method Summary
 Entity clone()
          Clone oneself.
 void fill(byte b)
          Fill this entity's value with all b.
 byte[] getValue()
          Get the value of this Entity.
 byte[] getValue(int offset, int length)
          Get a subset of this Entity's value.
 int length()
          Get the length of this Entity.
 void readFrom(InputStream is)
          Read value from an InputStream.
 void setValue(byte[] b)
          Set this Entity's value.
 void setValue(byte[] b, int offset, int length)
          Set this Entity's value to a subset of the specified byte[].
 void writeTo(OutputStream os)
          Write value to an OutputStream.
 

Method Detail

length

int length()
Get the length of this Entity.

Returns:
int

readFrom

void readFrom(InputStream is)
              throws IOException
Read value from an InputStream.

Parameters:
is - to read
Throws:
IOException - on error

writeTo

void writeTo(OutputStream os)
             throws IOException
Write value to an OutputStream.

Parameters:
os - to write to
Throws:
IOException - on error

clone

Entity clone()
Clone oneself.

Returns:
a deep (or otherwise "safe") copy of this Entity.

fill

void fill(byte b)
          throws IOException
Fill this entity's value with all b.

Parameters:
b - value
Throws:
IOException - on error

getValue

byte[] getValue()
Get the value of this Entity.

Returns:
byte[]

getValue

byte[] getValue(int offset,
                int length)
Get a subset of this Entity's value.

Parameters:
offset - to start
length - to extend
Returns:
byte[]

setValue

void setValue(byte[] b)
Set this Entity's value.

Parameters:
b - byte[]

setValue

void setValue(byte[] b,
              int offset,
              int length)
Set this Entity's value to a subset of the specified byte[].

Parameters:
b - byte[]
offset - int
length - int


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.