public abstract class Container extends Object implements IContainer, AutoCloseable
Provides the base class for containers.
Modifier and Type | Class and Description |
---|---|
static class |
Container.Entity
Provides the information of the container's entity.
|
static class |
Container.EntityParameter
Provides the information of the container's entity parameter.
|
Modifier | Constructor and Description |
---|---|
protected |
Container()
Initializes a new instance of the
Container class. |
|
Container(InputStream containerStream)
Initializes a new instance of the
Container class. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
dispose()
Releases the unmanaged resources used by the container.
|
protected void |
dispose(boolean disposing)
Releases the unmanaged resources used by the container.
|
protected InputStream |
getContainerStream()
Gets a stream of the container.
|
Charset |
getEncoding()
Gets an encoding for the container.
|
List<Container.Entity> |
getEntities()
Gets a collection of the container's entities.
|
String |
getMediaType()
Gets a media type for the container.
|
protected void |
load()
Loads a collection of the container's entities.
|
protected abstract List<Container.Entity> |
loadEntities()
Returns a collection of the container's entities.
|
InputStream |
openEntityStream(Container.Entity entity)
Opens a stream with the content of the container's entity.
|
protected abstract InputStream |
openStream(Container.Entity entity)
Returns the stream with the content of the
entity . |
void |
setEncoding(Charset value)
Sets an encoding for the container.
|
void |
setMediaType(String value)
Sets a media type for the container.
|
public Container(InputStream containerStream)
Initializes a new instance of the Container
class.
containerStream
- A stream of the container.ArgumentNullException
- containerStream
is null.protected Container()
Initializes a new instance of the Container
class.
public String getMediaType()
Gets a media type for the container.
public void setMediaType(String value)
Sets a media type for the container.
value
- A media type for the document. The default is null.public Charset getEncoding()
Gets an encoding for the container.
public void setEncoding(Charset value)
Sets an encoding for the container.
value
- An encoding for the container. The default is null.public List<Container.Entity> getEntities()
Gets a collection of the container's entities.
getEntities
in interface IContainer
protected InputStream getContainerStream()
Gets a stream of the container.
public void dispose()
Releases the unmanaged resources used by the container.
public void close() throws Exception
close
in interface AutoCloseable
Exception
public InputStream openEntityStream(Container.Entity entity)
Opens a stream with the content of the container's entity.
openEntityStream
in interface IContainer
entity
- A container's entity.protected void load()
Loads a collection of the container's entities.
protected void dispose(boolean disposing)
Releases the unmanaged resources used by the container.
disposing
- A boolean true if invoked from Dispose; otherwise, false.protected abstract InputStream openStream(Container.Entity entity)
Returns the stream with the content of the entity
.
entity
- The entity.java.io.InputStream
with the content of the entity.protected abstract List<Container.Entity> loadEntities()
Returns a collection of the container's entities.
Copyright © 2018. All rights reserved.