public class DefaultHomeInputStream
extends java.io.FilterInputStream
InputStream
filter that reads a home from a stream
at .sh3d file format.DefaultHomeOutputStream
Constructor and Description |
---|
DefaultHomeInputStream(java.io.File zipFile,
ContentRecording contentRecording,
HomeXMLHandler xmlHandler,
UserPreferences preferences,
boolean preferPreferencesContent)
Creates a home input stream able to read a home and its content from the given file.
|
DefaultHomeInputStream(java.io.InputStream in)
Creates a home input stream filter able to read a home and its content
from
in . |
DefaultHomeInputStream(java.io.InputStream in,
ContentRecording contentRecording)
Creates a home input stream filter able to read a home and its content
from
in . |
DefaultHomeInputStream(java.io.InputStream in,
ContentRecording contentRecording,
HomeXMLHandler xmlHandler,
UserPreferences preferences,
boolean preferPreferencesContent)
Creates a home input stream filter able to read a home and its content
from
in . |
DefaultHomeInputStream(java.io.InputStream in,
ContentRecording contentRecording,
UserPreferences preferences,
boolean preferPreferencesContent)
Creates a home input stream filter able to read a home and its content
from
in . |
Modifier and Type | Method and Description |
---|---|
boolean |
isPrefixCorrect()
Returns
true if the prefix of the read input stream is as expected. |
Home |
readHome()
Reads home from a zipped stream containing a
Home.xml or Home entry,
or if the stream isn't zipped, reads the input stream as a XML input stream. |
protected java.lang.Object |
resolveObjectInputStreamObject(java.lang.Object obj)
Returns
obj or a substitute of it during Home entry deserialization. |
public DefaultHomeInputStream(java.io.InputStream in) throws java.io.IOException
in
. The dependencies of the read home included in the stream
will be checked.java.io.IOException
public DefaultHomeInputStream(java.io.InputStream in, ContentRecording contentRecording) throws java.io.IOException
in
.java.io.IOException
public DefaultHomeInputStream(java.io.InputStream in, ContentRecording contentRecording, UserPreferences preferences, boolean preferPreferencesContent)
in
. If preferences
isn't null
and preferPreferencesContent
is true
,
the furniture and textures contents it references will replace the one of
the read home when they are equal. If preferPreferencesContent
is false
, preferences content will be used only
to replace damaged equal content that might be found in read home files.public DefaultHomeInputStream(java.io.InputStream in, ContentRecording contentRecording, HomeXMLHandler xmlHandler, UserPreferences preferences, boolean preferPreferencesContent)
in
.in
- the zipped stream from which the home will be readcontentRecording
- specifies whether content referenced by the read home is included
or not in the stream.xmlHandler
- SAX handler used to parse Home.xml
entry when present, or
null
if only Home
entry should taken into account.preferences
- if not null
and preferPreferencesContent
is true
, the furniture and textures contents it references will
replace the one of the read home when they are equal.
If preferPreferencesContent
is false
, preferences
content will be used only to replace damaged equal content that might be found
in read home files.preferPreferencesContent
- if true
, the returned home will reference
contents in preferences when equal.public DefaultHomeInputStream(java.io.File zipFile, ContentRecording contentRecording, HomeXMLHandler xmlHandler, UserPreferences preferences, boolean preferPreferencesContent) throws java.io.FileNotFoundException
zipFile
- the zipped file from which the home will be readcontentRecording
- specifies whether content referenced by the read home is included
or not in the stream.xmlHandler
- SAX handler used to parse Home.xml
entry when present, or
null
if only Home
entry should taken into account.preferences
- if not null
and preferPreferencesContent
is true
, the furniture and textures contents it references will
replace the one of the read home when they are equal.
If preferPreferencesContent
is false
, preferences
content will be used only to replace damaged equal content that might be found
in read home files.preferPreferencesContent
- if true
, the returned home will reference
contents in preferences when equal.java.io.FileNotFoundException
- if the given file can't be openedpublic boolean isPrefixCorrect() throws java.io.IOException
true
if the prefix of the read input stream is as expected.java.io.IOException
public Home readHome() throws java.io.IOException, java.lang.ClassNotFoundException
Home.xml
or Home
entry,
or if the stream isn't zipped, reads the input stream as a XML input stream.java.io.IOException
java.lang.ClassNotFoundException
protected java.lang.Object resolveObjectInputStreamObject(java.lang.Object obj) throws java.io.IOException
obj
or a substitute of it during Home entry deserialization.
This method does nothing and returns the obj
in parameter.
It can be overridden by sub classes if needed.java.io.IOException
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License