jbackup/src/main/java/org/jbundle/jbackup/source/FilesystemSource.java
public SourceFile next() {
		if (this.isPend())
			return this.getPend();
		if (m_iCurrentLevel == -1)
		{		// First time
			File fileDir = new File(m_strRootPath);
			m_iCurrentLevel++;
			if (!fileDir.isDirectory())
				return null;		// Never	// pend(don) Return 1 file?
			m_rgfileCurrentFilelist[m_iCurrentLevel] = fileDir.listFiles();
			m_rgstrCurrentPath[m_iCurrentLevel] = JBackupConstants.BLANK;	// Root (relative)
			m_rgiCurrentFile[m_iCurrentLevel] = 0;
		}

		while (true)
		{
			File[] fileList = m_rgfileCurrentFilelist[m_iCurrentLevel];		// Current list
			int iCurrentIndex = m_rgiCurrentFile[m_iCurrentLevel];
			if (iCurrentIndex >= fileList.length)
			{		// End of directory, go up a level
				m_rgfileCurrentFilelist[m_iCurrentLevel] = null;	// Free
				m_rgstrCurrentPath[m_iCurrentLevel] = null;
				m_rgiCurrentFile[m_iCurrentLevel] = 0;
				m_iCurrentLevel--;	// End of directory
				if (m_iCurrentLevel < 0)
					return null;		// End of files!
			}
			else
			{
				File file = fileList[iCurrentIndex];
				String strPath = m_rgstrCurrentPath[m_iCurrentLevel];
				m_rgiCurrentFile[m_iCurrentLevel]++;	// Bump for next time
				if (file.isDirectory())
				{	// This is a directory, go down a level
					strPath += file.getName() + gchSeparator;

					m_iCurrentLevel++;
					if (m_Filter == null)
						fileList = file.listFiles();
					else
						fileList = file.listFiles(m_Filter);
					m_rgfileCurrentFilelist[m_iCurrentLevel] = fileList;
					m_rgstrCurrentPath[m_iCurrentLevel] = strPath;	// Relative path to this directory
					m_rgiCurrentFile[m_iCurrentLevel] = 0;
					if (fileList == null)
						m_iCurrentLevel--;	// Special case - skip windows linked directory
				}
				else if (file.isFile())
				{
					String strName = file.getName();
					if (m_Filter != null)
					{
						if (!m_Filter.accept(file, strName))
							continue;		// HACK - The filter should do this
					}
					if (this.skipFile(file))
						continue;
					String strRelativeFileName = strPath + strName;
					long lStreamLength = file.length();

					return new StreamSourceFile(file, null, strRelativeFileName, strName, lStreamLength);		// Return the file
				}
			}
		}
	}
public SourceFile next() {
		if (this.isPend())
			return this.getPend();
		if (m_iCurrentLevel == -1)
		{		// First time
			File fileDir = new File(m_strRootPath);
			m_iCurrentLevel++;
			if (!fileDir.isDirectory())
				return null;		// Never	// pend(don) Return 1 file?
			m_rgfileCurrentFilelist[m_iCurrentLevel] = fileDir.listFiles();
			m_rgstrCurrentPath[m_iCurrentLevel] = JBackupConstants.BLANK;	// Root (relative)
			m_rgiCurrentFile[m_iCurrentLevel] = 0;
		}

		while (true)
		{
			File[] fileList = m_rgfileCurrentFilelist[m_iCurrentLevel];		// Current list
			int iCurrentIndex = m_rgiCurrentFile[m_iCurrentLevel];
			if (iCurrentIndex >= fileList.length)
			{		// End of directory, go up a level
				m_rgfileCurrentFilelist[m_iCurrentLevel] = null;	// Free
				m_rgstrCurrentPath[m_iCurrentLevel] = null;
				m_rgiCurrentFile[m_iCurrentLevel] = 0;
				m_iCurrentLevel--;	// End of directory
				if (m_iCurrentLevel < 0)
					return null;		// End of files!
			}
			else
			{
				File file = fileList[iCurrentIndex];
				String strPath = m_rgstrCurrentPath[m_iCurrentLevel];
				m_rgiCurrentFile[m_iCurrentLevel]++;	// Bump for next time
				if (file.isDirectory())
				{	// This is a directory, go down a level
					strPath += file.getName() + gchSeparator;

					m_iCurrentLevel++;
					if (m_Filter == null)
						fileList = file.listFiles();
					else
						fileList = file.listFiles(m_Filter);
					m_rgfileCurrentFilelist[m_iCurrentLevel] = fileList;
					m_rgstrCurrentPath[m_iCurrentLevel] = strPath;	// Relative path to this directory
					m_rgiCurrentFile[m_iCurrentLevel] = 0;
					if (fileList == null)
						m_iCurrentLevel--;	// Special case - skip windows linked directory
				}
				else if (file.isFile())
				{
					String strName = file.getName();
					if (m_Filter != null)
					{
						if (!m_Filter.accept(file, strName))
							continue;		// HACK - The filter should do this
					}
					if (this.skipFile(file))
						continue;
					String strRelativeFileName = strPath + strName;
					long lStreamLength = file.length();

					return new StreamSourceFile(file, null, strRelativeFileName, strName, lStreamLength);		// Return the file
				}
			}
		}
	}
Returns the next element in the iteration.
(Returns a SourceFileObject).

@returns the next element in the iteration.
@exception NoSuchElementException iteration has no more elements.