public class HomeFileRecorder extends java.lang.Object implements HomeRecorder
DefaultHomeOutputStream
and
DefaultHomeInputStream
.HomeRecorder.Type
Constructor and Description |
---|
HomeFileRecorder()
Creates a home recorder able to write and read homes in uncompressed files.
|
HomeFileRecorder(int compressionLevel)
Creates a home recorder able to write and read homes in files compressed
at a level from 0 to 9.
|
HomeFileRecorder(int compressionLevel,
boolean includeOnlyTemporaryContent)
Creates a home recorder able to write and read homes in files compressed
at a level from 0 to 9.
|
HomeFileRecorder(int compressionLevel,
boolean includeOnlyTemporaryContent,
UserPreferences preferences,
boolean preferPreferencesContent)
Creates a home recorder able to write and read homes in files compressed
at a level from 0 to 9.
|
HomeFileRecorder(int compressionLevel,
boolean includeOnlyTemporaryContent,
UserPreferences preferences,
boolean preferPreferencesContent,
boolean preferXmlEntry)
Creates a home recorder able to write and read homes in files compressed
at a level from 0 to 9.
|
HomeFileRecorder(int compressionLevel,
boolean includeOnlyTemporaryContent,
UserPreferences preferences,
boolean preferPreferencesContent,
boolean preferXmlEntry,
boolean acceptUrl)
Creates a home recorder able to write and read homes in files compressed
at a level from 0 to 9.
|
Modifier and Type | Method and Description |
---|---|
boolean |
exists(java.lang.String name)
Returns
true if the file name exists. |
protected HomeXMLExporter |
getHomeXMLExporter()
Returns an exporter able to generate the content of a
Home.xml entry. |
protected HomeXMLHandler |
getHomeXMLHandler()
Returns a SAX XML handler able to interpret the information contained in the
Home.xml entry. |
Home |
readHome(java.lang.String name)
Returns a home instance read from its file
name or an URL if it can be opened as a file. |
void |
writeHome(Home home,
java.lang.String name)
Writes home data.
|
public HomeFileRecorder()
public HomeFileRecorder(int compressionLevel)
compressionLevel
- 0 (uncompressed) to 9 (compressed).public HomeFileRecorder(int compressionLevel, boolean includeOnlyTemporaryContent)
compressionLevel
- 0-9includeOnlyTemporaryContent
- if true
, content instances of
TemporaryURLContent
class referenced by the saved home
as well as the content previously saved with it will be written.
If false
, all the content instances
referenced by the saved home will be written in the zip stream.public HomeFileRecorder(int compressionLevel, boolean includeOnlyTemporaryContent, UserPreferences preferences, boolean preferPreferencesContent)
compressionLevel
- 0-9includeOnlyTemporaryContent
- if true
, content instances of
TemporaryURLContent
class referenced by the saved home
as well as the content previously saved with it will be written.
If false
, all the content instances
referenced by the saved home will be written in the zip stream.preferences
- If not null
, the furniture and textures contents
it references might be used to replace the one of read homes
when they are equal.preferPreferencesContent
- If true
, the furniture and textures contents
referenced by preferences
will replace the one of read homes
as often as possible when they are equal. Otherwise, these contents will be
used only to replace damaged content that might be found in read home files.public HomeFileRecorder(int compressionLevel, boolean includeOnlyTemporaryContent, UserPreferences preferences, boolean preferPreferencesContent, boolean preferXmlEntry)
compressionLevel
- 0-9includeOnlyTemporaryContent
- if true
, content instances of
TemporaryURLContent
class referenced by the saved home
as well as the content previously saved with it will be written.
If false
, all the content instances
referenced by the saved home will be written in the zip stream.preferences
- If not null
, the furniture and textures contents
it references might be used to replace the one of read homes
when they are equal.preferPreferencesContent
- If true
, the furniture and textures contents
referenced by preferences
will replace the one of read homes
as often as possible when they are equal. Otherwise, these contents will be
used only to replace damaged content that might be found in read home files.preferXmlEntry
- If true
, an additional Home.xml
entry
will be saved in files and read in priority from saved files.public HomeFileRecorder(int compressionLevel, boolean includeOnlyTemporaryContent, UserPreferences preferences, boolean preferPreferencesContent, boolean preferXmlEntry, boolean acceptUrl)
compressionLevel
- 0-9includeOnlyTemporaryContent
- if true
, content instances of
TemporaryURLContent
class referenced by the saved home
as well as the content previously saved with it will be written.
If false
, all the content instances
referenced by the saved home will be written in the zip stream.preferences
- If not null
, the furniture and textures contents
it references might be used to replace the one of read homes
when they are equal.preferPreferencesContent
- If true
, the furniture and textures contents
referenced by preferences
will replace the one of read homes
as often as possible when they are equal. Otherwise, these contents will be
used only to replace damaged content that might be found in read home files.preferXmlEntry
- If true
, an additional Home.xml
entry
will be saved in files and read in priority from saved files.acceptUrl
- If true
, this recorder will try to read a home from a URL
if the path passed as parameter to readHome
isn't a file.public void writeHome(Home home, java.lang.String name) throws RecorderException
writeHome
in interface HomeRecorder
home
- the home to write.name
- the name of the resource in which the home will be written.RecorderException
- if a problem occurred while writing home.protected HomeXMLExporter getHomeXMLExporter()
Home.xml
entry.public Home readHome(java.lang.String name) throws RecorderException
name
or an URL if it can be opened as a file.readHome
in interface HomeRecorder
name
- the name of the resource from which the home will be read.RecorderException
- if a problem occurred while reading home,
or if file or URL name
doesn't exist.protected HomeXMLHandler getHomeXMLHandler()
Home.xml
entry.public boolean exists(java.lang.String name) throws RecorderException
true
if the file name
exists.exists
in interface HomeRecorder
name
- the name of the resource to checkRecorderException
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License