FileDocCategorySizeDatePackage
demoProgram.javaAPI DocExample4551Mon Sep 13 13:08:34 BST 1999None

demoProgram

public class demoProgram extends Object

Fields Summary
public Connection
connection
Constructors Summary
demoProgram()

Methods Summary
public voidconnect()

     String connectString;
     Class.forName ("oracle.jdbc.driver.OracleDriver");
     connectString = "jdbc:oracle:oci8:@";
     connection = DriverManager.getConnection(connectString,"ORDMEDIADEMO",
                                       "ORDMEDIADEMO");
     connection.setAutoCommit(false);
  
public static voidmain(java.lang.String[] args)

    byte[] ctx = new byte[4000]; 
    byte[] byteArray  = new byte[80]; 
    String tableName;
    String columnName;
    String dataCondition;
    demoProgram client = new demoProgram(); 

    try {

    	client.connect();
    	System.out.println("after Connected");
        OrdAudio audioObj = new OrdAudio(client.connection);
    
        System.out.println("Enter your search parameters");
        System.out.println("Enter table Name");
        System.in.read(byteArray);
        tableName = new String(byteArray);
        StringBuffer strBuffer = new StringBuffer(tableName.trim());
        tableName = new String(strBuffer);

         
        System.out.println("Enter column Name");
        System.in.read(byteArray);
        columnName = new String(byteArray);
        strBuffer = new StringBuffer(columnName.trim());
        columnName = new String(strBuffer);

        System.out.println("Enter Data Condition");
        System.in.read(byteArray);
        dataCondition= new String(byteArray);
        strBuffer = new StringBuffer(dataCondition.trim());
        dataCondition = new String(strBuffer);

        
        audioObj.setBindParams(tableName, columnName, dataCondition);
        //audioObj.setBindParams("TAUD", "aud", " N = 1" );
        audioObj.setProperties(ctx);
        audioObj.refresh(true);

        // getting audio related attributes
        System.out.println("Encoding : " + audioObj.getEncoding(ctx));
        System.out.println("Sample Size: " + audioObj.getSampleSize(ctx));
        System.out.println("Sampling Rate: " + audioObj.getSamplingRate(ctx));
        System.out.println("Format : " + audioObj.getFormat(ctx));

        // Comment related interface
        audioObj.appendToComments(5,"Drama");
        System.out.println("Comments :" + audioObj.readFromComments(1,5));
        audioObj.appendToComments(11," and Comedy");
        System.out.println("Comments :" + audioObj.readFromComments(1,16));
        System.out.println("Drama is in :" + 
                            audioObj.locateInComment("Drama",1,1));
        System.out.println("Comment Length output  : " + 
                               audioObj.getCommentLength());

        // get mime type information used by the players for playing the data
        System.out.println("MimeType: " +audioObj.getMimeType()); 
        
        // get source information
        System.out.println("SourceType : " +audioObj.getSourceType());
        System.out.println("SourceLocation : " +audioObj.getSourceLocation());
        System.out.println("SourceName: " +audioObj.getSourceName());
        System.out.println("SourceInformation: " +audioObj.getSource());

        // audio content related methods
        System.out.println(" getContentLength output  : " +
                             audioObj.getContentLength(ctx));
        // int length = audioObj.getContentLength(ctx);
        audioObj.getDataInFile("output.dat");

        audioObj.setDescription("Classic Collection");
        System.out.println("Description : " +
                            audioObj.getDescription());


        // tries to get the compression type of the audio data
        // should catch exception in case any exception is raised in the
        // server side
        try {
           audioObj.getCompressionType(ctx);
        }
        catch (Exception e) {
           System.out.println("Exception raised in getCompressionType " );
        }

        audioObj.flush();

        client.connection.close();

        System.out.println("after close");
    } catch (Exception e) {
    try {
      System.out.println("Exception : " + e);
      client.connection.close();
    } catch(Exception ex) {
      System.out.println("Close Connection Exception : " + ex );
    }
    }