|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.starteam.Content
public class Content
The value of a ContentProperty. Arbitrary data with an advisory content type.
| Nested Class Summary | |
|---|---|
static class |
Content.AcceptedTypes
This class represents an Accept request-header field. |
static class |
Content.Type
This class represents a MIME Content-Type value. |
static class |
Content.WebCacheContent
Content accessor for cached SDK content contained objects are obtained from the artifact cache |
| Field Summary | |
|---|---|
static Content |
VALUE_NOT_SET
The "not set" value. |
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
return true if this Content equals the other. |
boolean |
equalsEx(Content c)
|
static Content |
fromBytes(byte[] data,
Content.Type contentType,
java.lang.String name)
Creates a content value from a byte array, assigning a given content type. |
static Content |
fromBytes(byte[] data,
java.lang.String name)
Creates a content value from a byte array. |
static Content |
fromFile(java.io.File file)
Creates a content value from a file on disk. |
static Content |
fromFile(java.io.File file,
Content.Type contentType,
java.lang.String name)
Creates a content value from a file on disk, assigning a given content type. |
static Content |
fromStream(java.io.InputStream stream,
Content.Type contentType,
java.lang.String name)
Creates a content value from an input stream, assigning a given content type. |
static Content |
fromStream(java.io.InputStream stream,
java.lang.String name)
Creates a content value from an input stream. |
static Content |
fromText(java.lang.String data,
Content.Type contentType,
Encoding enc)
Create a text based content value from a string, assigning the specified content type and encoding |
Content.Type |
getContentType()
Gets the content type. |
int |
getID()
if this Content instance represents an attachment, returns the associated attachment ID |
MD5 |
getMD5()
|
java.lang.String |
getName()
returns the advisory name (or description) of this content the name is typically associated with a rendering mechanism on the client, e.g. |
long |
getSize()
|
boolean |
isEqualTo(Content c)
returns true if this Content object can be considered identical to the other |
void |
setName(java.lang.String name)
set an advisory name (or description) to be saved along with the content the name may typically be associated with a file name on the local platform and a rendering mechanism; e.g. |
byte[] |
toBytes()
|
void |
toFile(java.io.File file)
Writes the content data to the given file. |
void |
toStream(java.io.OutputStream stream)
Writes the content data to the given stream. |
java.lang.String |
toString()
Returns a String representation of the structure of this content Note that the returned string is not a representation of the content itself but rather the internal identifiers used to store the Content in the server vault This method will throw an exception if this content object is new or dirty and has not yet been saved to the repository |
java.lang.String |
toText()
Converts this content value to a string that is an appropriate value for a TextProperty. |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Content VALUE_NOT_SET
| Method Detail |
|---|
public static Content fromFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
file - The file containing the content data. The file name is used as
the advisory name of the content
java.io.FileNotFoundException
java.io.IOException
public static Content fromFile(java.io.File file,
Content.Type contentType,
java.lang.String name)
throws java.io.FileNotFoundException,
java.io.IOException
file - The file containing the content data.contentType - The content type.name - an advisory name for the content e.g. training.doc
java.io.FileNotFoundException
java.io.IOException
public static Content fromStream(java.io.InputStream stream,
java.lang.String name)
throws java.io.IOException
stream - The input stream providing the content data.name - an advisory name for the content e.g. training.doc
java.io.IOException
public static Content fromStream(java.io.InputStream stream,
Content.Type contentType,
java.lang.String name)
throws java.io.IOException
stream - The input stream providing the content data.contentType - The content type.name - an advisory name for the content e.g. training.doc
java.io.IOException
public static Content fromBytes(byte[] data,
java.lang.String name)
data - The byte array representing the content data.name - An advisory name for the content; e.g.training.doc
public static Content fromBytes(byte[] data,
Content.Type contentType,
java.lang.String name)
data - The byte array representing the content data.contentType - The content type.name - An advisory name for the content
public static Content fromText(java.lang.String data,
Content.Type contentType,
Encoding enc)
data - the payloadcontentType - the content type, should not be BINARYenc - a character encoding to use for translation
public Content.Type getContentType()
public long getSize()
Content.toFile(java.io.File),
Content.getMD5()public int getID()
public java.lang.String getName()
public void setName(java.lang.String name)
name - an advisory name to be stored along with the contentpublic MD5 getMD5()
Content.toFile(java.io.File),
Content.getMD5()
public void toStream(java.io.OutputStream stream)
throws java.io.IOException
stream - The stream to which the data is written.
java.io.IOException
public void toFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
file - The file to which the data is written.
java.io.FileNotFoundException
java.io.IOExceptionpublic byte[] toBytes()
public java.lang.String toText()
(a) The content type is one of text/*, and
(b) The character encoding is specified in the content type (for example,
text/plain; charset=UTF-8), and
(c) The character encoding is supported on the current platform.
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEqualTo(Content c)
c - the Content to compare against
public boolean equals(java.lang.Object o)
Content.equalsEx(Content)
A shallow test simply compares the Content Type and the data payload
equals in class java.lang.Objecto - the object to compare against
public boolean equalsEx(Content c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||