input
stringlengths
10
828
output
stringlengths
5
107
public time map frame to time int param return new time param
convert a frame number to a time
public int map time to frame javax media time time return 0
convert a time to a frame number
public void read frame buffer output buffer try pos demux read frame output buffer is video pos catch ioexception e
supply a frame of data to codec
public void set track listener track listener track listener
track listener for push streams
public string get name return jffmpeg avi file demultiplexer
return name of demultiplexer
public time get duration system out println avi file get duration duration return new time duration
returns the duration of this avi file
public time get media time system out println avi file get media time return new time double seek source tell end of header double end of file end of header
returns the current position in the avi file
public boolean is positionable system out println avi file is positionable return seek source is random access
can we reposition this stream
public void open throws javax media resource unavailable exception system out println avi file open
open the avi file
public format set input format format format system out println set intput formats format input format video format format initialise int input format get size get width int input format get size get height return format
negotiate the format for the input data
public format set output format format format system out println set outtput formats format return new rgbformat new dimension mb width 16 mb height 16 1 new int 0 get class array input format get frame rate frames sec 32 0xff0000 0x00ff00 0x0000ff colours
negotiate the format for screen display renderer
public jffmpeg video format get video codec string encoding return new jffmpeg video format encoding to lower case resources
return the codec information for this encoding
public jffmpeg audio format get audio codec string encoding return new jffmpeg audio format encoding to lower case resources
return the codec information for this encoding
public void set terminated boolean b is terminated b
sets the thread sate to terminated
public void test shutdown throws exception if run test if sys prop defined shutdown prop new mini admin conn shutdown
tests whether or not you can shutdown the server with mini admin
public void set up throws exception super set up if version meets minimum 4 0 if testblob null testblob length 32 1024 1024 testblob new byte 32 1024 1024 this stmt execute update set session max allowed packet math min testblob length 3 integer max value else if testblob null testblob length 8 1024 1024 testblob new byte 8 1024 1024 for 3 23 x int data range byte max value byte min value for int i 0 i testblob length i testblob i byte math random data range byte min value create test table
setup the test case
public void test bug8064 binary01 throws exception byte expected byte 0x80 not one of the first bytes of sjis double byte char byte 0x27 single quote insert byte array expected
tests fix for bug 8064
public void tear down throws exception try stmt execute update drop table if exists blobtest finally super tear down
destroy resources created by test case
public void test byte stream insert throws exception java io byte array input stream b in new java io byte array input stream testblob pstmt conn prepare statement insert into blobtest blobdata values pstmt set binary stream 1 b in testblob length pstmt execute pstmt clear parameters do retrieval
tests inserting blob data as a stream
public void test bytes insert throws exception pstmt conn prepare statement insert into blobtest blobdata values pstmt set bytes 1 testblob pstmt execute pstmt get update count pstmt clear parameters do retrieval
tests inserting blob data as byte
public void set up throws exception super set up register data source
sets up this test calling register data source to bind a data source
public void tear down throws exception ctx unbind temp dir get absolute path test ctx close temp dir delete super tear down
un binds the data source and cleans up the filesystem
public void test get columns throws exception try stmt execute create table if not exists longblob regress field 1 longblob database meta data dbmd conn get meta data result set dbmd rs null try dbmd rs dbmd get columns longblob regress while dbmd rs next dbmd rs get int 7 finally if dbmd rs null try dbmd rs close catch sqlexception ex finally stmt execute drop table if exists longblob regress
tests bug reported by open office team with get columns and longblob
public void test get columns unsigned throws exception try this stmt execute update drop table if exists test get unsigned cols this stmt execute update create table test get unsigned cols field1 smallint field2 smallint unsigned database meta data dbmd this conn get meta data this rs dbmd get columns this conn get catalog null test get unsigned cols while this rs next system out println rs get string 6 finally this stmt execute update drop table if exists test get unsigned cols
tests whether or not unsigned columns are reported correctly in
public void test long text throws exception try this stmt execute update drop table if exists test long text this stmt execute update create table test long text field1 longtext this rs this conn get meta data get columns this conn get catalog null test long text this rs next assert true this rs get int data type java sql types longvarchar finally this stmt execute update drop table if exists test long text
tests whether or not database meta data
public void test bug4742 throws exception hash map clash map new hash map this rs this conn get meta data get type info while this rs next string name rs get string 1 assert true type represented twice in type info name clash map contains key name clash map put name name
tests fix for bug 4742 double mapped twice in get type info
public void test is before first on empty throws exception try query with valid rows is before first correctly returns true rs stmt execute query show variables like version assert true non empty search should return true rs is before first query with empty result is before first falsely returns true sun s documentation says it should return false rs stmt execute query show variables like garbage assert true empty search should return false rs is before first finally rs close
tests a bug where result set
public void test meta data is writable throws exception try query with valid rows rs stmt execute query show variables like version result set meta data rsmd rs get meta data int num columns rsmd get column count for int i 1 i num columns i assert true rsmd is writable should rsmd is read only rsmd is writable i rsmd is read only i finally rs close
tests a bug where result set
public void set up throws exception super set up reset event count this close event count 0 this connection error event count 0 mysql connection pool data source ds new mysql connection pool data source ds set url base test case db url cpds ds
set up test case before a test is run
public void tear down cpds null
after the test is run
public void test newlines throws exception string newline str foo n bar n r baz stmt execute update drop table if exists newline regress test stmt execute update create table newline regress test field1 mediumtext try stmt execute update insert into newline regress test values newline str pstmt conn prepare statement insert into newline regress test values pstmt set string 1 newline str pstmt execute update rs stmt execute query select from newline regress test while rs next assert true rs get string 1 equals newline str finally stmt execute update drop table if exists newline regress test
tests newline being treated correctly
public void test not updatable throws exception prepared statement pstmt null result set rs null try string s query show variables pstmt conn prepare statement s query result set type scroll sensitive result set concur updatable rs pstmt execute query if rs next rs absolute 1 try rs update int 1 1 catch sqlexception sql ex assert true sql ex instanceof not updatable try rs update string 1 1 catch sqlexception sql ex assert true sql ex instanceof not updatable finally if pstmt null try pstmt close catch exception e ignore
tests fix for bug 1630 not updatable exception turning into npe on
public void test utf8 encoding throws exception if version meets minimum 4 1 properties props new properties props put character encoding utf8 props put use unicode true connection utf conn driver manager get connection db url props test conversion for string utf8 utf conn u043c u0438 u0445 u0438
tests that utf 8 character conversion works correctly
public void test parameter bounds check throws exception prepared statement pstmt this conn prepare statement update foo set f1 f2 f3 f4 where f5 pstmt set string 1 pstmt set string 2 try pstmt set string 25 pstmt set int 26 1 catch sqlexception sql ex assert true sqlerror sql state illegal argument equals sql ex get sqlstate
tests fix for bug 1658
public void test quoted id recognition throws exception try this stmt execute update drop table if exists test quoted id this stmt execute update create table test quoted id col1 varchar 32 prepared statement p stmt this conn prepare statement select from test quoted id from where col1 abc def or col1 p stmt set string 1 foo finally this stmt execute update drop table if exists test quoted id
tests fix for bug 1511
public void test set fetch size throws exception int old fetch size stmt get fetch size try stmt set fetch size 10 finally stmt set fetch size old fetch size
tests a bug where statement
public void set up throws exception super set up create jndicontext populate data source props
sets up this test calling register data source to bind a data source
public void tear down throws exception this ctx unbind temp dir get absolute path test this ctx unbind temp dir get absolute path test no url this ctx close this temp dir delete super tear down
un binds the data source and cleans up the filesystem
private void create jndicontext throws exception temp dir file create temp file jnditest null temp dir delete temp dir mkdir temp dir delete on exit mysql connection pool data source ds hashtable env new hashtable env put context initial context factory com sun jndi fscontext ref fscontext factory ctx new initial context env assert true naming context not created ctx null ds new mysql connection pool data source ds set url db url from base test case ds set database name test ctx bind temp dir get absolute path test ds
this method is separated from the rest of the example since you normally
public void set up throws exception class for name com mysql jdbc driver new instance this conn driver manager get connection db url this stmt conn create statement
creates resources used by all tests
public void tear down throws exception if this rs null try this rs close catch sqlexception sqle if this stmt null try this stmt close catch sqlexception sqle if this pstmt null try this pstmt close catch sqlexception sqle if this conn null try this conn close catch sqlexception sqle
destroys resources created during the test case
protected string get mysql variable string variable name throws sqlexception object value get single indexed value with query 2 show variables like variable name if value null return value to string else return null
returns the named my sql variable from the currently connected server
public void test bug9098 throws exception statement updatable stmt null try this stmt execute update drop table if exists test bug9098 this stmt execute update create table test bug9098 pkfield int primary key not null auto increment n tsfield timestamp not null default current timestamp updatable stmt this conn create statement result set type scroll insensitive result set concur updatable this rs updatable stmt execute query select pkfield tsfield from test bug9098 this rs move to insert row this rs insert row finally this stmt execute update drop table if exists test bug9098
tests fix for bug 9098 server doesnt give us info to distinguish
protected void check and fire connection error sqlexception sql ex throws sqlexception if this pooled connection null if sqlerror sql state communication link failure equals sql ex get sqlstate this pooled connection call listener mysql pooled connection connection error event sql ex throw sql ex
fires connection error event if required before re throwing exception
public void set auto commit boolean auto commit throws sqlexception if closed throw new sqlexception invalid handle str else try this mc set auto commit auto commit catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public boolean get auto commit throws sqlexception if closed throw new sqlexception invalid handle str else try return this mc get auto commit catch sqlexception sql exception check and fire connection error sql exception return false we don t reach this code compiler can t tell
passes call to method on physical connection instance
public void set catalog string catalog throws sqlexception if closed throw new sqlexception invalid handle str else try this mc set catalog catalog catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public string get catalog throws sqlexception if closed throw new sqlexception invalid handle str else try return this mc get catalog catch sqlexception sql exception check and fire connection error sql exception return null we don t reach this code compiler can t tell
passes call to method on physical connection instance
public boolean is closed throws sqlexception return closed this mc is closed
passes call to method on physical connection instance
public void set read only boolean read only throws sqlexception if closed throw new sqlexception invalid handle str else try this mc set read only read only catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public boolean is read only throws sqlexception if closed throw new sqlexception invalid handle str else try return this mc is read only catch sqlexception sql exception check and fire connection error sql exception return false we don t reach this code compiler can t tell
passes call to method on physical connection instance
public void set transaction isolation int level throws sqlexception if closed throw new sqlexception invalid handle str else try this mc set transaction isolation level catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public int get transaction isolation throws sqlexception if closed throw new sqlexception invalid handle str else try return this mc get transaction isolation catch sqlexception sql exception check and fire connection error sql exception return transaction repeatable read we don t reach this code compiler can t tell
passes call to method on physical connection instance
public void set type map java util map map throws sqlexception if closed throw new sqlexception invalid handle str else try this mc set type map map catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public void clear warnings throws sqlexception if closed throw new sqlexception invalid handle str else try this mc clear warnings catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public void commit throws sqlexception if closed throw new sqlexception invalid handle str else try this mc commit catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public string native sql string sql throws sqlexception if closed throw new sqlexception invalid handle str else try return this mc native sql sql catch sqlexception sql exception check and fire connection error sql exception return null we don t reach this code compiler can t tell
passes call to method on physical connection instance
public void rollback throws sqlexception if closed throw new sqlexception invalid handle str else try this mc rollback catch sqlexception sql exception check and fire connection error sql exception
passes call to method on physical connection instance
public string get driver version throws java sql sqlexception return mysql connector java 3 0 17 ga date 2005 04 06 14 12 56 revision 1 27 2 47
whats the version of this jdbc driver
public boolean is case sensitive int column throws java sql sqlexception field field get field column int sql type field get sqltype switch sql type case types bit case types tinyint case types smallint case types integer case types bigint case types float case types real case types double case types date case types time case types timestamp return false case types char case types varchar return field is binary default return true
does a columns case matter assumption any field that is
public string get column character encoding int column throws sqlexception string mysql name get column character set column string java name null if mysql name null java name string charset mapping mysql to java charset map get mysql name return java name
whats the java character encoding name for the given column
public int get column display size int column throws java sql sqlexception return int get field column get length
what is the columns normal maximum width in characters
public boolean is read only int column throws java sql sqlexception return get field column is read only
is the column definitely not writable
protected field get field int column index throws java sql sqlexception if column index 1 column index fields length throw new java sql sqlexception column index out of range sqlerror sql state invalid column number return fields column index 1
returns the field instance for the given column index
public void set time int parameter index time x throws sqlexception set time internal parameter index x this connection get default time zone
set a parameter to a java
public void clear parameters throws sqlexception for int i 0 i parameter values length i parameter values i null parameter streams i null is stream i false is null i false
in general parameter values remain in force for repeated used of a
public void close throws sqlexception super close this parse info null this dbmd null this original sql null this static sql strings null this parameter values null this parameter streams null this is stream null this stream lengths null this is null null this stream convert buf null
closes this prepared statement and releases all resources
protected void set retrieve generated keys boolean retrieve generated keys this retrieve generated keys retrieve generated keys
sets wheather or not this statement should retreive generated keys
public void set profile sql boolean flag throws sqlexception for re connection this props set property profile sql string value of flag get io set profile sql flag
should the driver do profiling
protected void check for charset mismatch if this connection use unicode this connection get encoding null string encoding to check jvm platform charset if encoding to check null encoding to check system get property file encoding if encoding to check null this platform db charset matches false else this platform db charset matches encoding to check equals this connection get encoding
determines if the database charset is the same as the platform charset
public void commit throws java sql sqlexception if driver trace object args new object 0 debug method call this commit args check closed try no op if relax auto commit true if this auto commit this relax auto commit throw new sqlexception can t call commit when autocommit true sqlerror sql state general error else if this transactions supported exec sql commit 1 this database finally if this reconnect at tx end ping and reconnect true return
the method commit makes all changes made since the previous
protected void finalize throws throwable cleanup null
cleanup the connection
public string native sql string sql throws java sql sqlexception if driver trace object args sql debug method call this native sql args debug return value this native sql sql return escape processor escape sql sql get io version meets minimum 4 0 2
a driver may convert the jdbc sql grammar into its systems native sql
public void reset server state throws sqlexception if this paranoid this io null this io version meets minimum 4 0 6 change user this user this password
resets the server side state of this connection
public void shutdown server throws sqlexception try this io send command mysql defs shutdown null null catch exception ex throw new sqlexception unhandled exception ex to string sqlerror sql state general error
used by mini admin to shutdown a my sql server
public string get system functions throws java sql sqlexception return database user system user session user password encrypt last insert id version
get a comma separated list of system functions
public string get user name throws java sql sqlexception if this conn use hosts in privileges statement stmt null result set rs null try stmt this conn create statement if stmt get max rows 0 stmt set max rows 0 rs stmt execute query select user rs next return rs get string 1 finally if rs null try rs close catch exception ex assertion failed exception should not happen ex rs null if stmt null try stmt close catch exception ex assertion failed exception should not happen ex stmt null else return this conn get user
whats our user name as known to the database
protected boolean is using unbuffered input return this use unbuffered input
is this connection using unbuffered input
private void set failed over state throws sqlexception if this fail over read only set read only true this queries issued failed over 0 this failed over true this master fail time millis system current time millis
sets state for a failed over connection
private void load server variables throws sqlexception com mysql jdbc statement stmt null com mysql jdbc result set results null try stmt com mysql jdbc statement create statement if stmt get max rows 0 stmt set max rows 0 results com mysql jdbc result set stmt execute query show variables while results next this server variables put results get string 1 results get string 2 catch java sql sqlexception e throw e finally if results null try results close catch java sql sqlexception sql e if stmt null try stmt close catch java sql sqlexception sql e
loads the result of show variables into the server variables field so
public boolean supports convert throws java sql sqlexception return true
is the convert function between sql types supported
public boolean supports select for update throws java sql sqlexception return this conn get io version meets minimum 3 23 36
is select for update supported
protected string get server character encoding return string this server variables get character set
returns the servers character set
public void add net work file file net work file string report name if net work file null throw new illegal argument exception the network file must be not null if report name null throw new illegal argument exception the report name must be not null if net work files contains key net work file net work files put net work file report name grid service add resource net work file
adds a epanets network file and a name for its output for grid
public void add net work file string net work file path string nome relatorio if net work file path null throw new illegal argument exception the net work file path must be not null add net work file new file net work file path nome relatorio
adds a epanets network file and a name for its output for grid
public int compare network component o1 network component o2 string nome1 o1 label string nome2 o2 label string ord1 string utils extrai ordem nome1 to string string ord2 string utils extrai ordem nome2 to string string alpha1 string utils extrai alpha nome1 string alpha2 string utils extrai alpha nome2 int alpha comparation alpha1 compare to alpha2 if alpha comparation 0 if ord1 length 0 ord2 length 0 return new integer ord1 int value new integer ord2 int value if ord1 length 0 ord2 length 0 return ord1 length ord2 length return alpha comparation return o1 label compare to o2 label
compares code network component code using their label properties
public void set code long code this code code
set the json rpc error code for this exception
public long get code return code
get the json rpc error code of this exception
private string generate method signature method m int parmscount 0 class paramclasses m get parameter types string mname if use full classname mname m get declaring class get name m get name else mname m get name for int j 0 j paramclasses length j if paramclasses j get name matches org json jsonobject return mname jsonobject else if paramclasses j get name matches java util hash map return mname hash map else if paramclasses j get name matches java lang string paramclasses j is primitive parmscount else return null return mname parmscount
this method generates a string containing the signature of a
private response handle exception exception e throws jsonexception response response new response e if detailed errors response clear error data fire message event generate message jsonrpcmessage exception null null return response
this method attempts to turn generic exceptions into valid jsonrpc
private response handle exception throwable t response response throws jsonexception response new response t if detailed errors response clear error data fire message event generate message jsonrpcmessage exception null null return response
this method attempts to take a throwable object and turn it into a
private void clear messages alert dialog builder builder new alert dialog builder this builder set message are you sure you want to clear all messages set cancelable false set positive button yes new dialog interface on click listener public void on click dialog interface dialog int id get content resolver delete get intent get data null null set negative button no new dialog interface on click listener public void on click dialog interface dialog int id dialog cancel alert dialog alert builder create alert show
clear all messages stored with a confirmation
private void failure send message false
failure when attempt to connect no reason
private void failure exception e send message false
failure when attempt to connect with the given exception
private void send message boolean result message msg m handler obtain message bundle b new bundle b put boolean connected result msg set data b m handler send message msg
send the result to the main thread
public void play play 0
play the current attitune
public void play float start string pattern http 127 0 0 1 54321 d attitune manager start attitune by name begin f name s try url url new url string format pattern 0 start name replace 20 urlconnection connection url open connection connection get input stream buffered reader buffered reader new buffered reader new input stream reader connection get input stream string line while line buffered reader read line null system out println line catch malformed urlexception e e print stack trace catch ioexception e e print stack trace
play the current attitune from start
public void set field string name string value if name equals author set author value else if name equals category set category value else if name equals description set description value else if name equals keywords set keywords value else if name equals language set language value else if name equals length set length float parse float value else if name equals name set name value else if name equals sub category set sub category value else if name equals version set version value
set the given field
private void load images string name int id bitmap image bitmap factory decode resource m context get resources id m images put name image
load the given image
public void close stop true
close the connection