public class Content
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
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
|
| Modifier and Type | Field and Description |
|---|---|
static Content |
VALUE_NOT_SET
The "not set" value.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final Content VALUE_NOT_SET
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 contentjava.io.FileNotFoundExceptionjava.io.IOExceptionpublic 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.docjava.io.FileNotFoundExceptionjava.io.IOExceptionpublic 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.docjava.io.IOExceptionpublic 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.docjava.io.IOExceptionpublic 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.docpublic 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 contentpublic 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 translationpublic 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.IOExceptionpublic void toFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
file - The file to which the data is written.java.io.FileNotFoundExceptionjava.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 againstpublic boolean equals(java.lang.Object o)
Content.equalsEx(Content) A
shallow test simply compares the Content Type and the data payloadequals in class java.lang.Objecto - the object to compare againstpublic boolean equalsEx(Content c)
StarTeam SDK 17.0, Build 34
Copyright © 2019 Micro Focus or one of its affiliates. All rights reserved.