Package toxi.util
Class FileSequenceDescriptor
java.lang.Object
toxi.util.FileSequenceDescriptor
A descriptor and iterator for handling file sequences.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFileSequenceDescriptor
(String filePattern, String extension, int numDigits, int start) Creates a new descriptor from the given sequence details. -
Method Summary
Modifier and TypeMethodDescriptionReturns the base path of the sequence, i.e.int
Calculates sequence durationint
Identifies the index of the last file of the sequence.getPathForIndex
(int i) Constructs the file path for the given absolute indexint
Returns the index of the first file of the sequence.iterator()
Creates an iterator providing paths for each file in the sequence.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
filePattern
-
extension
-
numDigits
public int numDigits -
start
public int start -
end
public int end
-
-
Constructor Details
-
FileSequenceDescriptor
Creates a new descriptor from the given sequence details.- Parameters:
filePattern
- file pattern in the format: e.g. "path/basename%d04.ext"extension
- file extension (e.g. ".tga")numDigits
- number of digits used for the indexstart
- start index
-
-
Method Details
-
getBasePath
Returns the base path of the sequence, i.e. the substring of the sequence's file pattern from the beginning until the first occurence of the % sign indicating the frame numbers.- Returns:
- path string
-
getDuration
public int getDuration()Calculates sequence duration- Returns:
- number of files in sequence
-
getFinalIndex
public int getFinalIndex()Identifies the index of the last file of the sequence.- Returns:
- final index
-
getPathForIndex
Constructs the file path for the given absolute index- Parameters:
i
- index- Returns:
- path
-
getStartIndex
public int getStartIndex()Returns the index of the first file of the sequence.- Returns:
- start index
-
iterator
Creates an iterator providing paths for each file in the sequence. The iterator does not support the remove() method and attempts to use it results in anUnsupportedOperationException
being thrown.
-