Package com.twelvemonkeys.io.ole2
Class Entry
- java.lang.Object
-
- com.twelvemonkeys.io.ole2.Entry
-
- All Implemented Interfaces:
java.lang.Comparable<Entry>
public final class Entry extends java.lang.Object implements java.lang.Comparable<Entry>
Represents an OLE 2 compound document entry. This is similar to a file in a file system, or an entry in a ZIP or JAR file.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/ole2/Entry.java#4 $
- See Also:
CompoundDocument
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.SortedSet<Entry>
children
(package private) long
createdTimestamp
(package private) CompoundDocument
document
(package private) static int
EMPTY
static int
LENGTH
(package private) static int
LOCK_BYTES
(package private) long
modifiedTimestamp
(package private) java.lang.String
name
(package private) int
nextDId
private static java.util.SortedSet<Entry>
NO_CHILDREN
(package private) byte
nodeColor
(package private) Entry
parent
(package private) int
prevDId
(package private) static int
PROPERTY
(package private) static int
ROOT_STORAGE
(package private) int
rootNodeDId
(package private) int
startSId
(package private) int
streamSize
(package private) byte
type
(package private) static int
USER_STORAGE
(package private) static int
USER_STREAM
-
Constructor Summary
Constructors Modifier Constructor Description private
Entry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Entry pOther)
long
created()
Returns the time that this entry was created.boolean
equals(java.lang.Object pOther)
java.util.SortedSet<Entry>
getChildEntries()
Returns the children of thisEntry
.Entry
getChildEntry(java.lang.String pName)
Returns the child of thisEntry
with the given name.SeekableInputStream
getInputStream()
Returns theInputStream
for thisEntry
java.lang.String
getName()
Returns the name of thisEntry
Entry
getParentEntry()
Return the parent of thisEntry
int
hashCode()
boolean
isDirectory()
Iftrue
thisEntry
is a directoryEntry
.boolean
isFile()
Iftrue
thisEntry
is a file (document)Entry
.boolean
isRoot()
Iftrue
thisEntry
is the rootEntry
.long
lastModified()
Returns the time that this entry was last modified.long
length()
Returns the length of this entryprivate void
read(java.io.DataInput pInput)
Reads this entry(package private) static Entry
readEntry(java.io.DataInput pInput)
Reads an entry from the input.java.lang.String
toString()
-
-
-
Field Detail
-
name
java.lang.String name
-
type
byte type
-
nodeColor
byte nodeColor
-
prevDId
int prevDId
-
nextDId
int nextDId
-
rootNodeDId
int rootNodeDId
-
createdTimestamp
long createdTimestamp
-
modifiedTimestamp
long modifiedTimestamp
-
startSId
int startSId
-
streamSize
int streamSize
-
document
CompoundDocument document
-
parent
Entry parent
-
children
java.util.SortedSet<Entry> children
-
LENGTH
public static final int LENGTH
- See Also:
- Constant Field Values
-
EMPTY
static final int EMPTY
- See Also:
- Constant Field Values
-
USER_STORAGE
static final int USER_STORAGE
- See Also:
- Constant Field Values
-
USER_STREAM
static final int USER_STREAM
- See Also:
- Constant Field Values
-
LOCK_BYTES
static final int LOCK_BYTES
- See Also:
- Constant Field Values
-
PROPERTY
static final int PROPERTY
- See Also:
- Constant Field Values
-
ROOT_STORAGE
static final int ROOT_STORAGE
- See Also:
- Constant Field Values
-
NO_CHILDREN
private static final java.util.SortedSet<Entry> NO_CHILDREN
-
-
Method Detail
-
readEntry
static Entry readEntry(java.io.DataInput pInput) throws java.io.IOException
Reads an entry from the input.- Parameters:
pInput
- the input data- Returns:
- the
Entry
read from the input data - Throws:
java.io.IOException
- if an i/o exception occurs during reading
-
read
private void read(java.io.DataInput pInput) throws java.io.IOException
Reads this entry- Parameters:
pInput
- the input data- Throws:
java.io.IOException
- if an i/o exception occurs during reading
-
isRoot
public boolean isRoot()
Iftrue
thisEntry
is the rootEntry
.- Returns:
true
if this is the rootEntry
-
isDirectory
public boolean isDirectory()
Iftrue
thisEntry
is a directoryEntry
.- Returns:
true
if this is a directoryEntry
-
isFile
public boolean isFile()
Iftrue
thisEntry
is a file (document)Entry
.- Returns:
true
if this is a documentEntry
-
getName
public java.lang.String getName()
Returns the name of thisEntry
- Returns:
- the name of this
Entry
-
getInputStream
public SeekableInputStream getInputStream() throws java.io.IOException
Returns theInputStream
for thisEntry
- Returns:
- an
InputStream
containing the data for thisEntry
ornull
if this is a directoryEntry
- Throws:
java.io.IOException
- if an I/O exception occurs- See Also:
length()
-
length
public long length()
Returns the length of this entry- Returns:
- the length of the stream for this entry, or
0
if this is a directoryEntry
- See Also:
getInputStream()
-
created
public long created()
Returns the time that this entry was created. The time is converted from its internal representation to standard Java representation, milliseconds since the epoch (00:00:00 GMT, January 1, 1970).Note that most applications leaves this value empty (
0L
).- Returns:
- A
long
value representing the time this entry was created, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or0L
if no creation time stamp exists for this entry.
-
lastModified
public long lastModified()
Returns the time that this entry was last modified. The time is converted from its internal representation to standard Java representation, milliseconds since the epoch (00:00:00 GMT, January 1, 1970).Note that many applications leaves this value empty (
0L
).- Returns:
- A
long
value representing the time this entry was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or0L
if no modification time stamp exists for this entry.
-
getParentEntry
public Entry getParentEntry()
Return the parent of thisEntry
- Returns:
- the parent of this
Entry
, ornull
if this is the rootEntry
-
getChildEntry
public Entry getChildEntry(java.lang.String pName) throws java.io.IOException
Returns the child of thisEntry
with the given name.- Parameters:
pName
- the name of the childEntry
- Returns:
- the child
Entry
ornull
if thee is no such child - Throws:
java.io.IOException
- if an I/O exception occurs
-
getChildEntries
public java.util.SortedSet<Entry> getChildEntries() throws java.io.IOException
Returns the children of thisEntry
.- Returns:
- a
SortedSet
ofEntry
objects - Throws:
java.io.IOException
- if an I/O exception occurs
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object pOther)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-