com.tngtech.jgiven.attachment
Class MediaType

java.lang.Object
  extended by com.tngtech.jgiven.attachment.MediaType

public class MediaType
extends java.lang.Object

Represents a Media Type.

Since:
0.7.0

Nested Class Summary
static class MediaType.Type
          Represents the type of a Media Type
 
Field Summary
static MediaType PLAIN_TEXT
           
static MediaType PNG
           
 
Constructor Summary
MediaType(MediaType.Type type, java.lang.String subType, boolean binary)
          Creates a new MediaType
 
Method Summary
 java.lang.String asString()
           
static MediaType audio(java.lang.String subType)
          Creates a binary audio media type with the given subtype.
 java.lang.String getSubType()
          The subtype of the Media Type.
 MediaType.Type getType()
          The type of the Media Type.
static MediaType image(java.lang.String subType)
          Creates a binary image media type with the given subtype.
 boolean isBinary()
          Whether this media type is binary or not.
static MediaType text(java.lang.String subType)
          Creates a non-binary text media type with the given subtype.
static MediaType video(java.lang.String subType)
          Creates a binary video media type with the given subtype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PNG

public static final MediaType PNG

PLAIN_TEXT

public static final MediaType PLAIN_TEXT
Constructor Detail

MediaType

public MediaType(MediaType.Type type,
                 java.lang.String subType,
                 boolean binary)
Creates a new MediaType

Parameters:
type - the type
subType - the subtype
binary - whether or not content of this media type is binary. If true, the content will be encoded as Base64 when stored in the JSON model.
Method Detail

getType

public MediaType.Type getType()
The type of the Media Type.


getSubType

public java.lang.String getSubType()
The subtype of the Media Type.


isBinary

public boolean isBinary()
Whether this media type is binary or not.


asString

public java.lang.String asString()

image

public static MediaType image(java.lang.String subType)
Creates a binary image media type with the given subtype.


video

public static MediaType video(java.lang.String subType)
Creates a binary video media type with the given subtype.


audio

public static MediaType audio(java.lang.String subType)
Creates a binary audio media type with the given subtype.


text

public static MediaType text(java.lang.String subType)
Creates a non-binary text media type with the given subtype.