org.xiph.libshout
Class Shout

java.lang.Object
  extended by org.xiph.libshout.Shout

public class Shout
extends java.lang.Object

jlibshout: org.benow.jlibshout.Shout

Author:
andy

Field Summary
static java.lang.String AI_BITRATE
           
static java.lang.String AI_CHANNELS
           
static java.lang.String AI_QUALITY
           
static java.lang.String AI_SAMPLERATE
           
static int FORMAT_MP3
           
static int FORMAT_VORBIS
           
static java.lang.String METADATA_NAME
           
static java.lang.String METADATA_SONG
           
static java.lang.String METADATA_URL
           
static int PROTOCOL_HTTP
           
static int PROTOCOL_ICY
           
static int PROTOCOL_XAUDIOCAST
           
 
Constructor Summary
Shout()
          Constructor.
 
Method Summary
 void close()
          Close the connection to the server
 void connect()
          Connects to the server.
protected  void finalize()
           
 java.lang.String getAgent()
          Gets the agent used during http authentication
 java.lang.String getAudioInfo()
          Gets the extended information describing the stream
 java.lang.String getDescription()
          Gets the description of the stream.
 java.lang.String getDumpFile()
          Gets the server dumpfile used to save the stream
 int getFormat()
          Gets the format of the stream (ie ogg/mp3).
 java.lang.String getGenre()
          Gets the genre for the strea
 java.lang.String getHost()
          Gets the host to which shout is to connect
 java.lang.String getLastError()
          Gets a description of the last error thrown by shout.
 java.lang.String getMount()
          Get the protoocol used for the connection to the server.
 java.lang.String getName()
          Gets the name of the stream.
 java.lang.String getPassword()
          Gets the encoder password
 int getPort()
          Gets the port on the host to which shout is to connect to
 int getProtocol()
          Get the protoocol used for the connection to the server.
 java.lang.String getURL()
          Gets the URL for the stream
 java.lang.String getUser()
          Gets the user used for HTTP connections
static java.lang.String getVersion()
           
 boolean isPublic()
          Gets whether or not the stream is public
 void setAgent(java.lang.String agent)
          Sets the agent used during authentication
 void setAudioInfo(java.lang.String info)
          Sets the extended information describing the stream
 void setDescription(java.lang.String desc)
          Sets the description of the stream
 void setDumpfile(java.lang.String dumpfile)
          Sets the name of the dumpfile to which the stream is to be saved
 void setFormat(int format)
          Sets the format of the stream.
 void setGenre(java.lang.String genre)
          Sets the genre for the strea
 void setHost(java.lang.String host)
          Sets the host to which shout is to connect
 void setMetadata()
          Sets the metadata to be the current.
 void setMount(java.lang.String mount)
          Sets the mount used for the connection to the server
 void setName(java.lang.String name)
          Sets the name of the stream
 void setPassword(java.lang.String password)
          Sets the encoder password.
 void setPort(int port)
          Set port on the host to which shout is to connect
 void setProtocol(int protocol)
          Sets the protocol used for the connection to the server.
 void setPublic(boolean isPublic)
          Sets the public flag.
 void setURL(java.lang.String url)
          Sets the url for the stream
 void setUser(java.lang.String user)
          Sets the user used for HTTP authentication
 void sync()
          Waits until more data is required.
 void updateMetadata(java.lang.String name, java.lang.String value)
          Sets the metadata value for the given name.
 void write(byte[] toWrite)
          Writes data to the open connection.
 void write(byte[] toWrite, int offs, int len)
          Writes to the open connection.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_VORBIS

public static final int FORMAT_VORBIS
See Also:
Constant Field Values

FORMAT_MP3

public static final int FORMAT_MP3
See Also:
Constant Field Values

PROTOCOL_HTTP

public static final int PROTOCOL_HTTP
See Also:
Constant Field Values

PROTOCOL_XAUDIOCAST

public static final int PROTOCOL_XAUDIOCAST
See Also:
Constant Field Values

PROTOCOL_ICY

public static final int PROTOCOL_ICY
See Also:
Constant Field Values

AI_BITRATE

public static final java.lang.String AI_BITRATE
See Also:
Constant Field Values

AI_SAMPLERATE

public static final java.lang.String AI_SAMPLERATE
See Also:
Constant Field Values

AI_CHANNELS

public static final java.lang.String AI_CHANNELS
See Also:
Constant Field Values

AI_QUALITY

public static final java.lang.String AI_QUALITY
See Also:
Constant Field Values

METADATA_NAME

public static final java.lang.String METADATA_NAME
See Also:
Constant Field Values

METADATA_SONG

public static final java.lang.String METADATA_SONG
See Also:
Constant Field Values

METADATA_URL

public static final java.lang.String METADATA_URL
See Also:
Constant Field Values
Constructor Detail

Shout

public Shout()
      throws ShoutException
Constructor.

Throws:
ShoutException
Method Detail

getVersion

public static java.lang.String getVersion()
Returns:
version

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()

getHost

public java.lang.String getHost()
Gets the host to which shout is to connect

Returns:
the host to connect to

setHost

public void setHost(java.lang.String host)
             throws ShoutException
Sets the host to which shout is to connect

Parameters:
host - the host to connect to
Throws:
ShoutException

getPort

public int getPort()
Gets the port on the host to which shout is to connect to

Returns:
the port on the host to which shout is to connect

setPort

public void setPort(int port)
             throws ShoutException
Set port on the host to which shout is to connect

Parameters:
port - on host to connect to
Throws:
ShoutException

getPassword

public java.lang.String getPassword()
Gets the encoder password

Returns:
the encoder password

setPassword

public void setPassword(java.lang.String password)
                 throws ShoutException
Sets the encoder password.

Parameters:
password - the password on the server
Throws:
ShoutException

getURL

public java.lang.String getURL()
Gets the URL for the stream

Returns:
the url for the stream

setURL

public void setURL(java.lang.String url)
            throws ShoutException
Sets the url for the stream

Parameters:
url - the url for the stream
Throws:
ShoutException

getGenre

public java.lang.String getGenre()
Gets the genre for the strea

Returns:
the genre for the stream

setGenre

public void setGenre(java.lang.String genre)
              throws ShoutException
Sets the genre for the strea

Parameters:
genre - the genre for the stream
Throws:
ShoutException

getUser

public java.lang.String getUser()
Gets the user used for HTTP connections

Returns:
the user used for HTTP authentication

setUser

public void setUser(java.lang.String user)
             throws ShoutException
Sets the user used for HTTP authentication

Parameters:
user - the user used for http authentication
Throws:
ShoutException

getAgent

public java.lang.String getAgent()
Gets the agent used during http authentication

Returns:
the agent used during authentication

setAgent

public void setAgent(java.lang.String agent)
              throws ShoutException
Sets the agent used during authentication

Parameters:
agent - the agent used during authentication
Throws:
ShoutException

setName

public void setName(java.lang.String name)
             throws ShoutException
Sets the name of the stream

Parameters:
name - the name of the stream
Throws:
ShoutException

getName

public java.lang.String getName()
Gets the name of the stream.

Returns:
the name of the stream

setDescription

public void setDescription(java.lang.String desc)
                    throws ShoutException
Sets the description of the stream

Parameters:
desc - the description of the stream
Throws:
ShoutException - on pain

getDescription

public java.lang.String getDescription()
Gets the description of the stream.

Returns:
the description of the stream

getDumpFile

public java.lang.String getDumpFile()
Gets the server dumpfile used to save the stream

Returns:
the name of the file on the server to which the stream is to be saved

setDumpfile

public void setDumpfile(java.lang.String dumpfile)
Sets the name of the dumpfile to which the stream is to be saved

Parameters:
dumpfile - the name of the file on the server to which the stream is to be saved.

setAudioInfo

public void setAudioInfo(java.lang.String info)
                  throws ShoutException
Sets the extended information describing the stream

Parameters:
info - the information describing the stream
Throws:
ShoutException

getAudioInfo

public java.lang.String getAudioInfo()
Gets the extended information describing the stream

Returns:
extended information describing the stream

isPublic

public boolean isPublic()
Gets whether or not the stream is public

Returns:
true if advertised, false if not

setPublic

public void setPublic(boolean isPublic)
               throws ShoutException
Sets the public flag. If set, the stream will be advertised

Parameters:
isPublic - true if the stream is to be advertised, false if not.
Throws:
ShoutException

setFormat

public void setFormat(int format)
               throws ShoutException
Sets the format of the stream.

Parameters:
format -
Throws:
ShoutException

getFormat

public int getFormat()
Gets the format of the stream (ie ogg/mp3). One of the FORMAT_* constants.

Returns:
the format of the stream (FORMAT_*)

setProtocol

public void setProtocol(int protocol)
                 throws ShoutException
Sets the protocol used for the connection to the server. One of the (PROTOCOL_* constants)

Parameters:
protocol - sets the protocol used for the connection
Throws:
ShoutException

getProtocol

public int getProtocol()
Get the protoocol used for the connection to the server. One of the (PROTOCOL_* constants)

Returns:
the protocol used for connection (PROTOCOL_*)

connect

public void connect()
             throws ShoutException
Connects to the server.

Throws:
ShoutException

write

public void write(byte[] toWrite)
           throws java.io.IOException,
                  ShoutException
Writes data to the open connection.

Parameters:
toWrite -
Throws:
java.io.IOException
ShoutException

write

public void write(byte[] toWrite,
                  int offs,
                  int len)
           throws java.io.IOException,
                  ShoutException
Writes to the open connection. Incoming byte array is converted to short for native write.

Parameters:
toWrite - bytes to write
offs - offset to start at
len - length to write
Throws:
java.io.IOException
ShoutException

setMount

public void setMount(java.lang.String mount)
              throws ShoutException
Sets the mount used for the connection to the server

Parameters:
mount - sets the mount used for the connection
Throws:
ShoutException

getMount

public java.lang.String getMount()
Get the protoocol used for the connection to the server.

Returns:
the mount used for connection

getLastError

public java.lang.String getLastError()
Gets a description of the last error thrown by shout.

Returns:
error string

sync

public void sync()
Waits until more data is required.


close

public void close()
           throws ShoutException
Close the connection to the server

Throws:
ShoutException - on bad

updateMetadata

public void updateMetadata(java.lang.String name,
                           java.lang.String value)
                    throws ShoutException
Sets the metadata value for the given name.

Parameters:
name - name of the metadata entry. Could be one of the METADATA_* constants.
value - value for the metadata entry
Throws:
ShoutException
See Also:
setMetadata()

setMetadata

public void setMetadata()
                 throws ShoutException
Sets the metadata to be the current. Usage would be something like:

Throws:
ShoutException