Java File.getName() gets a path and does a substring on it,
this operation is called on a per-event level and should be cached.
Change-Id: Ib8bd18df3bc0ac307f65fde615d151c832918a64
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/38740
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
*/
private final File fFile;
+ /**
+ * The file name
+ */
+ private final String fFileName;
+
/**
* The packet index of this input
*/
public CTFStreamInput(CTFStream stream, File file) {
fStream = stream;
fFile = file;
+ String name = fFile.getName();
+ if (name == null) {
+ throw new IllegalStateException("File cannot have a null name"); //$NON-NLS-1$
+ }
+ fFileName = name;
+
fIndex = new StreamInputPacketIndex();
/*
* Create the definitions we need to read the packet headers + contexts
* @return the filename of the streaminput file.
*/
public String getFilename() {
- String name = fFile.getName();
- if (name == null) {
- throw new IllegalStateException("File cannot have a null name"); //$NON-NLS-1$
- }
- return name;
+ return fFileName;
}
/**