Package org.apache.sling.fsprovider.internal.mapper

# Class ContentFile

java.lang.Object
org.apache.sling.fsprovider.internal.mapper.ContentFile

public final class ContentFile extends Object
Reference to a file that contains a content fragment (e.g. JSON, JCR XML).

## Constructor Summary

Constructors
Constructor
Description
`ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache)`
`ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache, ContentType contentType)`

## Method Summary

Modifier and Type
Method
Description
`Iterator<Map.Entry<String,ContentElement>>`
`getChildren()`
`ContentElement`
`getContent()`
Content object referenced by sub path.
`File`
`getFile()`
`String`
`getPath()`
`String`
`getSubPath()`
`org.apache.sling.api.resource.ValueMap`
`getValueMap()`
`boolean`
`hasContent()`
`ContentFile`
`navigateToAbsolute(String newSubPath)`
Navigate to another sub path position in content file.
`ContentFile`
`navigateToRelative(String newSubPath)`
Navigate to another sub path position in content file.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ContentFile

public ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache)

Parameters:
  `file` - File with content fragment
  `path` - Root path of the content file
  `subPath` - Relative path addressing content fragment inside file
  `contentFileCache` - Content file cache

### ContentFile

public ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache, ContentType contentType)

Parameters:
  `file` - File with content fragment
  `path` - Root path of the content file
  `subPath` - Relative path addressing content fragment inside file
  `contentFileCache` - Content file cache
  `contentType` - Content type

## Method Details

### getFile

public File getFile()

Returns:
  File with content fragment

### getPath

public String getPath()

Returns:
  Root path of content file

### getSubPath

public String getSubPath()

Returns:
  Relative path addressing content fragment inside file

### getContent

public ContentElement getContent()
Content object referenced by sub path.

Returns:
  Map if resource, property value if property.

### hasContent

public boolean hasContent()

Returns:
  true if any content was found.

### getValueMap

public org.apache.sling.api.resource.ValueMap getValueMap()

Returns:
  ValueMap for resource. Never null.

### getChildren

public Iterator<Map.Entry<String,ContentElement>> getChildren()

Returns:
  Child maps.

### navigateToAbsolute

public ContentFile navigateToAbsolute(String newSubPath)
Navigate to another sub path position in content file.

Parameters:
  `newSubPath` - New sub path related to root path of content file
Returns:
  Content file

### navigateToRelative

public ContentFile navigateToRelative(String newSubPath)
Navigate to another sub path position in content file.

Parameters:
  `newSubPath` - New sub path relative to current sub path in content file
Returns:
  Content file