signature:
public class StreamingPlaybackController { /** * Bind to the streaming service . */
protected final void bind ( ) { } }

implementation: if ( bindRequested ) { return ; } final boolean result = context . bindService ( createBindIntent ( ) , serviceConnection , 0 ) ; if ( DEBUG ) { Log . v ( TAG , "Bind to streaming service: " + result ) ; } bindRequested = result ; onBind ( result ) ;


signature:
public class StreamingPlaybackController { /** * Unbind from the streaming service . */
protected final void unbind ( ) { } }

implementation: if ( streamingPlayback != null ) { dropListener ( ) ; } try { context . unbindService ( serviceConnection ) ; } catch ( final RuntimeException e ) { if ( DEBUG ) { Log . w ( TAG , "Cannot unbind radio" , e ) ; } } bindRequested = false ;


signature:
public class StreamingPlaybackController { /** * Drop streaming service listener . */
protected final void dropListener ( ) { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "Drop listener" ) ; } if ( streamingPlayback != null ) { try { streamingPlayback . removeListener ( ) ; } catch ( final RemoteException e ) { Log . e ( TAG , "Cannot remove listener" , e ) ; } bindRequested = false ; }


signature:
public class ImageRequest { /** * Store image to the disk cache .
 * If max allowed size is set image may be rescaled on disk .
 * @ throws IOException if error happens */
public void storeToDisk ( ) throws IOException { } }

implementation:
if ( manager . isPresentOnDisk ( url ) ) { return ; } if ( ! hasAllowedSize ( ) ) { IoUtils . consumeStream ( getRemoteInputStream ( ) , manager . getBuffersPool ( ) ) ; return ; } ImageResult result = decodeStream ( getRemoteInputStream ( ) , true ) ; if ( result . getType ( ) == ImageSourceType . NETWORK && result . getBitmap ( ) != null ) { // image was scaled
writeBitmapToDisk ( result . getBitmap ( ) ) ; }


signature:
public class ImageRequestsBuilder { /** * Plan an image on loading .
 * @ param url image URL
 * @ return this for chaining */
public ImageRequestsBuilder add ( final String url ) { } }

implementation: requests . add ( new ImageRequest ( manager , url , defaultAllowedSize ) ) ; return this ;


signature:
public class ImageRequestsBuilder { /** * Plan an image on loading .
 * @ param url image URL
 * @ param relativeSize max allowed image size relatively to the screen size
 * @ return this for chaining */
public ImageRequestsBuilder add ( final String url , final float relativeSize ) { } }

implementation: requests . add ( new ImageRequest ( manager , url , relativeSize ) ) ; return this ;


signature:
public class BaseRequestDescriptionConverter { /** * Composes URI builder using { @ link RequestDescription # getUrl ( ) } and { @ link RequestDescription # getSimpleParameters ( ) } .
 * @ return request URI builder */
protected Uri . Builder buildUri ( ) { } }

implementation: final Uri . Builder builder = Uri . parse ( requestDescription . getUrl ( ) ) . buildUpon ( ) ; for ( final Parameter p : requestDescription . getSimpleParameters ( ) . getChildren ( ) ) { if ( p instanceof ParameterValue ) { builder . appendQueryParameter ( p . getName ( ) , ( ( ParameterValue ) p ) . getValue ( ) ) ; } } return builder ;


signature:
public class IoUtils { /** * Read all the bytes from input stream and convert them to a string .
 * Input stream is closed after this method invocation .
 * @ param stream input stream
 * @ param charset input characters set name
 * @ param buffersPool buffers pool instance , may be null
 * @ return string
 * @ throws IOException if an error happens */
public static String streamToString ( final InputStream stream , final String charset , final BuffersPool buffersPool ) throws IOException { } }

implementation: ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; transfer ( stream , output , buffersPool ) ; return new String ( output . toByteArray ( ) , charset ) ;


signature:
public class IoUtils { /** * Read all the bytes from input stream and convert them to a string using UTF - 8 charset .
 * Input stream is closed after this method invocation .
 * @ param stream input stream
 * @ param buffersPool buffers pool instance , may be null
 * @ return string
 * @ throws IOException if an error happens */
public static String streamToString ( final InputStream stream , final BuffersPool buffersPool ) throws IOException { } }

implementation: return streamToString ( stream , UTF_8_NAME , buffersPool ) ;


signature:
public class IoUtils { /** * Transfers all the bytes from input to output stream .
 * If read / write operations are successful , output stream will be flushed .
 * Input stream is always closed after this method invocation .
 * @ param input input stream
 * @ param output output stream
 * @ param buffersPool buffers pool used to obtain a temporal bytes buffer , may be null
 * @ throws IOException if an error happens */
public static void transfer ( final InputStream input , final OutputStream output , final BuffersPool buffersPool ) throws IOException { } }

implementation: final InputStream in = buffersPool == null ? new BufferedInputStream ( input , BUFFER_SIZE_8K ) : new PoolableBufferedInputStream ( input , BUFFER_SIZE_8K , buffersPool ) ; final byte [ ] buffer = buffersPool == null ? new byte [ BUFFER_SIZE_8K ] : buffersPool . get ( BUFFER_SIZE_8K ) ; try { int cnt ; while ( ( cnt = in . read ( buffer ) ) != EOF ) { output . write ( buffer , 0 , cnt ) ; } output . flush ( ) ; } finally { closeQuietly ( in ) ; if ( buffersPool != null ) { buffersPool . release ( buffer ) ; } }


signature:
public class IoUtils { /** * Consume the stream and close it .
 * This implementation calls { @ link InputStream # read ( byte [ ] ) } method and ignores any read bytes .
 * @ param input input stream
 * @ throws IOException if I / O error happens */
public static void consumeStream ( final InputStream input , final BuffersPool buffersPool ) throws IOException { } }

implementation:
// do not use skip , just use a buffer and read it all
final byte [ ] buffer = buffersPool == null ? new byte [ BUFFER_SIZE_8K ] : buffersPool . get ( BUFFER_SIZE_8K ) ; try { // noinspection StatementWithEmptyBody
while ( input . read ( buffer ) != EOF ) ; } finally { closeQuietly ( input ) ; if ( buffersPool != null ) { buffersPool . release ( buffer ) ; } }


signature:
public class IoUtils { /** * Gets stream of uncompressed bytes for the { @ link URLConnection } wrapping its input stream
 * according to what is defined in its content encoding .
 * Supported encodings : { @ link # ENCODING _ GZIP } , { @ link # ENCODING _ DEFLATE } .
 * @ param connection given URL connection
 * @ return an uncompressed { @ link InputStream } for the given { @ link URLConnection } .
 * @ see # getUncompressedInputStream ( String , java . io . InputStream ) */
public static InputStream getUncompressedInputStream ( final URLConnection connection ) throws IOException { } }

implementation: final InputStream source = connection . getInputStream ( ) ; final String encoding = connection . getContentEncoding ( ) ; return getUncompressedInputStream ( encoding , source ) ;


signature:
public class IoUtils { /** * Wraps the supplied stream into either { @ link GZIPInputStream } or { @ link InflaterInputStream }
 * depending on { @ code encoding } parameter value .
 * @ param encoding content encoding , supported values : { @ link # ENCODING _ GZIP } , { @ link # ENCODING _ DEFLATE }
 * @ param source source stream
 * @ return the uncompressed { @ link InputStream }
 * @ see # getUncompressedInputStream ( java . net . URLConnection ) */
public static InputStream getUncompressedInputStream ( final String encoding , final InputStream source ) throws IOException { } }

implementation:
if ( ENCODING_GZIP . equalsIgnoreCase ( encoding ) ) { return new GZIPInputStream ( source ) ; } if ( ENCODING_DEFLATE . equalsIgnoreCase ( encoding ) ) { final Inflater inflater = new Inflater ( /* no header */
true ) ; return new InflaterInputStream ( source , inflater ) ; } return source ;


signature:
public class RemoteServerApiConfiguration { /** * Throw { @ link IllegalArgumentException } if the specified bean does not exist in the beans container .
 * @ param name bean name */
protected void checkBeanExists ( final String name ) { } }

implementation: if ( name == null ) { throw new NullPointerException ( "Bean name cannot be null" ) ; } if ( ! beansManager . getContainer ( ) . containsBean ( name ) ) { throw new IllegalArgumentException ( "Bean " + name + " does not exist" ) ; }


signature:
public class StringPart { /** * Writes the data to the given OutputStream .
 * @ param out the OutputStream to write to
 * @ throws IOException if there is a write error */
@ Override protected void sendData ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendData(OutputStream)" ) ; } out . write ( getContent ( ) ) ;


signature:
public class PoolableBufferedInputStream { /** * Returns the number of bytes that are available before this stream will
 * block . This method returns the number of bytes available in the buffer
 * plus those available in the source stream .
 * @ return the number of bytes available before blocking .
 * @ throws IOException
 * if this stream is closed . */
@ Override public synchronized int available ( ) throws IOException { } }

implementation:
final InputStream localIn = in ; // ' in ' could be invalidated by close ( )
if ( buf == null || localIn == null ) { throw new IOException ( "Stream is closed" ) ; } return count - pos + localIn . available ( ) ;


signature:
public class PoolableBufferedInputStream { /** * Closes this stream . The source stream is closed and any resources
 * associated with it are released .
 * @ throws IOException
 * if an error occurs while closing this stream . */
@ Override public void close ( ) throws IOException { } }

implementation: final byte [ ] localBuf = buf ; buf = null ; final InputStream localIn = in ; in = null ; pool . release ( localBuf ) ; if ( localIn != null ) { localIn . close ( ) ; }


signature:
public class PoolableBufferedInputStream { /** * Reads a single byte from this stream and returns it as an integer in the
 * range from 0 to 255 . Returns - 1 if the end of the source string has been
 * reached . If the internal buffer does not contain any available bytes then
 * it is filled from the source stream and the first byte is returned .
 * @ return the byte read or - 1 if the end of the source stream has been
 * reached .
 * @ throws IOException
 * if this stream is closed or another IOException occurs . */
@ Override public synchronized int read ( ) throws IOException { } }

implementation:
// Use local refs since buf and in may be invalidated by an
// unsynchronized close ( )
byte [ ] localBuf = buf ; final InputStream localIn = in ; if ( localBuf == null || localIn == null ) { throw new IOException ( "Stream is closed" ) ; } /* Are there buffered bytes available ? */
if ( pos >= count && fillbuf ( localIn , localBuf ) == - 1 ) { return - 1 ; /* no , fill buffer */
} // localBuf may have been invalidated by fillbuf
if ( localBuf != buf ) { localBuf = buf ; if ( localBuf == null ) { throw new IOException ( "Stream is closed" ) ; } } /* Did filling the buffer fail with - 1 ( EOF ) ? */
final int mask = 0xFF ; if ( count - pos > 0 ) { return localBuf [ pos ++ ] & mask ; } return - 1 ;


signature:
public class PoolableBufferedInputStream { /** * Reads at most { @ code length } bytes from this stream and stores them in
 * byte array { @ code buffer } starting at offset { @ code offset } . Returns the
 * number of bytes actually read or - 1 if no bytes were read and the end of
 * the stream was encountered . If all the buffered bytes have been used , a
 * mark has not been set and the requested number of bytes is larger than
 * the receiver ' s buffer size , this implementation bypasses the buffer and
 * simply places the results directly into { @ code buffer } .
 * @ param buffer
 * the byte array in which to store the bytes read .
 * @ param start
 * the initial position in { @ code buffer } to store the bytes read
 * from this stream .
 * @ param length
 * the maximum number of bytes to store in { @ code buffer } .
 * @ return the number of bytes actually read or - 1 if end of stream .
 * @ throws IndexOutOfBoundsException
 * if { @ code offset < 0 } or { @ code length < 0 } , or if
 * { @ code offset + length } is greater than the size of
 * { @ code buffer } .
 * @ throws IOException
 * if the stream is already closed or another IOException
 * occurs . */
@ Override public synchronized int read ( final byte [ ] buffer , final int start , final int length ) throws IOException { } }

implementation:
int offset = start ; // Use local ref since buf may be invalidated by an unsynchronized
// close ( )
byte [ ] localBuf = buf ; if ( localBuf == null ) { throw new IOException ( "Stream is closed" ) ; } // avoid int overflow
// BEGIN android - changed
// Exception priorities ( in case of multiple errors ) differ from
// RI , but are spec - compliant .
// made implicit null check explicit , used ( offset | length ) < 0
// instead of ( offset < 0 ) | | ( length < 0 ) to safe one operation
if ( buffer == null ) { throw new NullPointerException ( "Buffer is null" ) ; } if ( ( offset | length ) < 0 || offset > buffer . length - length ) { throw new IndexOutOfBoundsException ( "Bad offsets" ) ; } // END android - changed
if ( length == 0 ) { return 0 ; } final InputStream localIn = in ; if ( localIn == null ) { throw new IOException ( "Stream is closed" ) ; } int required ; if ( pos < count ) { /* There are bytes available in the buffer . */
final int copylength = count - pos >= length ? length : count - pos ; System . arraycopy ( localBuf , pos , buffer , offset , copylength ) ; pos += copylength ; if ( copylength == length || localIn . available ( ) == 0 ) { return copylength ; } offset += copylength ; required = length - copylength ; } else { required = length ; } while ( true ) { int read ; /* * If we ' re not marked and the required size is greater than the
 * buffer , simply read the bytes directly bypassing the buffer . */
if ( markpos == - 1 && required >= localBuf . length ) { read = localIn . read ( buffer , offset , required ) ; if ( read == - 1 ) { return required == length ? - 1 : length - required ; } } else { if ( fillbuf ( localIn , localBuf ) == - 1 ) { return required == length ? - 1 : length - required ; } // localBuf may have been invalidated by fillbuf
if ( localBuf != buf ) { localBuf = buf ; if ( localBuf == null ) { throw new IOException ( "Stream is closed" ) ; } } read = count - pos >= required ? required : count - pos ; System . arraycopy ( localBuf , pos , buffer , offset , read ) ; pos += read ; } required -= read ; if ( required == 0 ) { return length ; } if ( localIn . available ( ) == 0 ) { return length - required ; } offset += read ; }


signature:
public class PoolableBufferedInputStream { /** * Resets this stream to the last marked location .
 * @ throws IOException
 * if this stream is closed , no mark has been set or the mark is
 * no longer valid because more than { @ code readlimit } bytes
 * have been read since setting the mark .
 * @ see # mark ( int ) */
@ Override public synchronized void reset ( ) throws IOException { } }

implementation:
// BEGIN android - changed
/* * These exceptions get thrown in some " normalish " circumstances ,
 * so it is preferable to avoid loading up the whole big set of
 * messages just for these cases . */
if ( buf == null ) { throw new IOException ( "Stream is closed" ) ; } if ( - 1 == markpos ) { throw new IOException ( "Mark has been invalidated." ) ; } // END android - changed
pos = markpos ;


signature:
public class PoolableBufferedInputStream { /** * Skips { @ code amount } number of bytes in this stream . Subsequent
 * { @ code read ( ) } ' s will not return these bytes unless { @ code reset ( ) } is
 * used .
 * @ param amount
 * the number of bytes to skip . { @ code skip } does nothing and
 * returns 0 if { @ code amount } is less than zero .
 * @ return the number of bytes actually skipped .
 * @ throws IOException
 * if this stream is closed or another IOException occurs . */
@ Override public synchronized long skip ( final long amount ) throws IOException { } }

implementation:
// Use local refs since buf and in may be invalidated by an
// unsynchronized close ( )
final byte [ ] localBuf = buf ; final InputStream localIn = in ; if ( localBuf == null ) { throw new IOException ( "Stream is closed" ) ; } if ( amount < 1 ) { return 0 ; } if ( localIn == null ) { throw new IOException ( "Stream is closed" ) ; } if ( count - pos >= amount ) { pos += amount ; return amount ; } long read = count - pos ; pos = count ; if ( markpos != - 1 && amount <= marklimit ) { if ( fillbuf ( localIn , localBuf ) == - 1 ) { return read ; } if ( count - pos >= amount - read ) { pos += amount - read ; return amount ; } // Couldn ' t get all the bytes , skip what we read
read += ( count - pos ) ; pos = count ; return read ; } return read + localIn . skip ( amount - read ) ;


signature:
public class Part { /** * Write the start to the specified output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendStart ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendStart(OutputStream out)" ) ; } out . write ( EXTRA_BYTES ) ; out . write ( getPartBoundary ( ) ) ; out . write ( CRLF_BYTES ) ;


signature:
public class Part { /** * Write the content disposition header to the specified output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendDispositionHeader ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendDispositionHeader(OutputStream out)" ) ; } out . write ( CONTENT_DISPOSITION_BYTES ) ; out . write ( QUOTE_BYTES ) ; out . write ( EncodingUtils . getAsciiBytes ( getName ( ) ) ) ; out . write ( QUOTE_BYTES ) ;


signature:
public class Part { /** * Write the content type header to the specified output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendContentTypeHeader ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendContentTypeHeader(OutputStream out)" ) ; } final String contentType = getContentType ( ) ; if ( contentType != null ) { out . write ( CRLF_BYTES ) ; out . write ( CONTENT_TYPE_BYTES ) ; out . write ( EncodingUtils . getAsciiBytes ( contentType ) ) ; final String charSet = getCharSet ( ) ; if ( charSet != null ) { out . write ( CHARSET_BYTES ) ; out . write ( EncodingUtils . getAsciiBytes ( charSet ) ) ; } }


signature:
public class Part { /** * Write the content transfer encoding header to the specified
 * output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendTransferEncodingHeader ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendTransferEncodingHeader(OutputStream out)" ) ; } final String transferEncoding = getTransferEncoding ( ) ; if ( transferEncoding != null ) { out . write ( CRLF_BYTES ) ; out . write ( CONTENT_TRANSFER_ENCODING_BYTES ) ; out . write ( EncodingUtils . getAsciiBytes ( transferEncoding ) ) ; }


signature:
public class Part { /** * Write the end of the header to the output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendEndOfHeader ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendEndOfHeader(OutputStream out)" ) ; } out . write ( CRLF_BYTES ) ; out . write ( CRLF_BYTES ) ;


signature:
public class Part { /** * Write the end data to the output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
protected void sendEnd ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter sendEnd(OutputStream out)" ) ; } out . write ( CRLF_BYTES ) ;


signature:
public class Part { /** * Write all the data to the output stream .
 * If you override this method make sure to override
 * # length ( ) as well
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs . */
public void send ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter send(OutputStream out)" ) ; } sendStart ( out ) ; sendDispositionHeader ( out ) ; sendContentTypeHeader ( out ) ; sendTransferEncodingHeader ( out ) ; sendEndOfHeader ( out ) ; sendData ( out ) ; sendEnd ( out ) ;


signature:
public class Part { /** * Return the full length of all the data .
 * If you override this method make sure to override
 * # send ( OutputStream ) as well
 * @ return long The length .
 * @ throws IOException If an IO problem occurs */
public long length ( ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "enter length()" ) ; } if ( lengthOfData ( ) < 0 ) { return - 1 ; } final ByteArrayOutputStream overhead = new ByteArrayOutputStream ( ) ; sendStart ( overhead ) ; sendDispositionHeader ( overhead ) ; sendContentTypeHeader ( overhead ) ; sendTransferEncodingHeader ( overhead ) ; sendEndOfHeader ( overhead ) ; sendEnd ( overhead ) ; return overhead . size ( ) + lengthOfData ( ) ;


signature:
public class Part { /** * Write all parts and the last boundary to the specified output stream .
 * @ param out The stream to write to .
 * @ param parts The parts to write .
 * @ param partBoundary The ASCII bytes to use as the part boundary .
 * @ throws IOException If an I / O error occurs while writing the parts .
 * @ since 3.0 */
public static void sendParts ( final OutputStream out , final Part [ ] parts , final byte [ ] partBoundary ) throws IOException { } }

implementation:
if ( parts == null ) { throw new IllegalArgumentException ( "Parts may not be null" ) ; } if ( partBoundary == null || partBoundary . length == 0 ) { throw new IllegalArgumentException ( "partBoundary may not be empty" ) ; } for ( int i = 0 ; i < parts . length ; i ++ ) { // set the part boundary before the part is sent
parts [ i ] . setPartBoundary ( partBoundary ) ; parts [ i ] . send ( out ) ; } out . write ( EXTRA_BYTES ) ; out . write ( partBoundary ) ; out . write ( EXTRA_BYTES ) ; out . write ( CRLF_BYTES ) ;


signature:
public class Part { /** * Gets the length of the multipart message including the given parts .
 * @ param parts The parts .
 * @ param partBoundary The ASCII bytes to use as the part boundary .
 * @ return The total length
 * @ throws IOException If an I / O error occurs while writing the parts .
 * @ since 3.0 */
public static long getLengthOfParts ( final Part [ ] parts , final byte [ ] partBoundary ) throws IOException { } }

implementation:
if ( DEBUG ) { Log . v ( TAG , "getLengthOfParts(Parts[])" ) ; } if ( parts == null ) { throw new IllegalArgumentException ( "Parts may not be null" ) ; } long total = 0 ; for ( int i = 0 ; i < parts . length ; i ++ ) { // set the part boundary before we calculate the part ' s length
parts [ i ] . setPartBoundary ( partBoundary ) ; final long l = parts [ i ] . length ( ) ; if ( l < 0 ) { return - 1 ; } total += l ; } total += EXTRA_BYTES . length ; total += partBoundary . length ; total += EXTRA_BYTES . length ; total += CRLF_BYTES . length ; return total ;


signature:
public class WebsockifyProxyHandler { /** * if it is , it returns the url parameter */
private String isRedirect ( String uri ) throws URISyntaxException , MalformedURLException { } }

implementation:
// Decode the path .
URI url = new URI ( uri ) ; if ( REDIRECT_PATH . equals ( url . getPath ( ) ) ) { String query = url . getRawQuery ( ) ; Map < String , String > params = getQueryMap ( query ) ; String urlParam = params . get ( URL_PARAMETER ) ; if ( urlParam == null ) return null ; try { return URLDecoder . decode ( urlParam , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { Logger . getLogger ( WebsockifyProxyHandler . class . getName ( ) ) . severe ( e . getMessage ( ) ) ; } } return null ;


signature:
public class WebsockifyProxyHandler { /** * When file timestamp is the same as what the browser is sending up , send a " 304 Not Modified "
 * @ param ctx
 * Context */
private void sendNotModified ( ChannelHandlerContext ctx ) { } }

implementation:
HttpResponse response = new DefaultHttpResponse ( HTTP_1_1 , HttpResponseStatus . NOT_MODIFIED ) ; setDateHeader ( response ) ; // Close the connection as soon as the error message is sent .
ctx . getChannel ( ) . write ( response ) . addListener ( ChannelFutureListener . CLOSE ) ;


signature:
public class WebsockifyProxyHandler { /** * Sets the Date header for the HTTP response
 * @ param response
 * HTTP response */
private void setDateHeader ( HttpResponse response ) { } }

implementation: SimpleDateFormat dateFormatter = new SimpleDateFormat ( HTTP_DATE_FORMAT , Locale . US ) ; dateFormatter . setTimeZone ( TimeZone . getTimeZone ( HTTP_DATE_GMT_TIMEZONE ) ) ; Calendar time = new GregorianCalendar ( ) ; response . setHeader ( HttpHeaders . Names . DATE , dateFormatter . format ( time . getTime ( ) ) ) ;


signature:
public class WebsockifyProxyHandler { /** * Sets the Date and Cache headers for the HTTP Response
 * @ param response
 * HTTP response
 * @ param fileToCache
 * file to extract content type */
private void setDateAndCacheHeaders ( HttpResponse response , File fileToCache ) { } }

implementation:
SimpleDateFormat dateFormatter = new SimpleDateFormat ( HTTP_DATE_FORMAT , Locale . US ) ; dateFormatter . setTimeZone ( TimeZone . getTimeZone ( HTTP_DATE_GMT_TIMEZONE ) ) ; // Date header
Calendar time = new GregorianCalendar ( ) ; response . setHeader ( HttpHeaders . Names . DATE , dateFormatter . format ( time . getTime ( ) ) ) ; // Add cache headers
time . add ( Calendar . SECOND , HTTP_CACHE_SECONDS ) ; response . setHeader ( HttpHeaders . Names . EXPIRES , dateFormatter . format ( time . getTime ( ) ) ) ; response . setHeader ( HttpHeaders . Names . CACHE_CONTROL , "private, max-age=" + HTTP_CACHE_SECONDS ) ; response . setHeader ( HttpHeaders . Names . LAST_MODIFIED , dateFormatter . format ( new Date ( fileToCache . lastModified ( ) ) ) ) ;


signature:
public class WebsockifyProxyHandler { /** * Sets the content type header for the HTTP Response
 * @ param response
 * HTTP response
 * @ param file
 * file to extract content type */
private void setContentTypeHeader ( HttpResponse response , File file ) { } }

implementation: MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap ( ) ; response . setHeader ( HttpHeaders . Names . CONTENT_TYPE , mimeTypesMap . getContentType ( file . getPath ( ) ) ) ;


signature:
public class WebsockifyProxyHandler { /** * Closes the specified channel after all queued write requests are flushed . */
static void closeOnFlush ( Channel ch ) { } }

implementation: if ( ch . isConnected ( ) ) { ch . write ( ChannelBuffers . EMPTY_BUFFER ) . addListener ( ChannelFutureListener . CLOSE ) ; }


signature:
public class FilePart { /** * Write the disposition header to the output stream .
 * @ param out The output stream
 * @ throws IOException If an IO problem occurs
 * @ see Part # sendDispositionHeader ( OutputStream ) */
@ Override protected void sendDispositionHeader ( final OutputStream out ) throws IOException { } }

implementation: if ( DEBUG ) { Log . v ( "FilePart" , "enter sendDispositionHeader(OutputStream out)" ) ; } super . sendDispositionHeader ( out ) ; final String filename = this . source . getFileName ( ) ; if ( filename != null ) { out . write ( FILE_NAME_BYTES ) ; out . write ( QUOTE_BYTES ) ; out . write ( EncodingUtils . getAsciiBytes ( filename ) ) ; out . write ( QUOTE_BYTES ) ; }


signature:
public class FilePart { /** * Write the data in " source " to the specified stream .
 * @ param out The output stream .
 * @ throws IOException if an IO problem occurs .
 * @ see Part # sendData ( OutputStream ) */
@ Override protected void sendData ( final OutputStream out ) throws IOException { } }

implementation:
if ( DEBUG ) { Log . v ( TAG , "enter sendData(OutputStream out)" ) ; } if ( lengthOfData ( ) == 0 ) { // this file contains no data , so there is nothing to send .
// we don ' t want to create a zero length buffer as this will
// cause an infinite loop when reading .
if ( DEBUG ) { Log . d ( TAG , "No data to send." ) ; } return ; } final int size = 4096 ; final byte [ ] tmp = new byte [ size ] ; final InputStream instream = source . createInputStream ( ) ; try { int len ; while ( ( len = instream . read ( tmp ) ) >= 0 ) { out . write ( tmp , 0 , len ) ; } } finally { // we ' re done with the stream , close it
instream . close ( ) ; }


signature:
public class BaseFileResponseCache { /** * Setup cache . This operation causes disk reads .
 * @ param version cache version
 * @ throws IOException if error happens */
protected void install ( final int version ) throws IOException { } }

implementation: if ( buffersPool == null ) { throw new IllegalStateException ( "Buffers pool is not resolved" ) ; } diskCache = DiskLruCache . open ( ensureWorkingDirectory ( ) , version , ENTRIES_COUNT , getMaxSize ( ) ) ; onCacheInstalled ( ) ;


signature:
public class BaseFileResponseCache { /** * this method is synchronized in order to avoid concurrent calls to mkdir */
private synchronized File ensureWorkingDirectory ( ) throws IOException { } }

implementation: File directory = getWorkingDirectory ( ) ; if ( ! directory . exists ( ) ) { if ( ! directory . mkdirs ( ) ) { throw new IOException ( "Working directory " + directory + " cannot be created" ) ; } } else { if ( ! directory . isDirectory ( ) ) { if ( ! directory . delete ( ) ) { throw new IOException ( directory + " is not a directory and cannot be deleted" ) ; } if ( ! directory . mkdirs ( ) ) { throw new IOException ( "Working directory " + directory + " cannot be recreated" ) ; } } } return directory ;


signature:
public class BaseFileResponseCache { /** * Read cache for the specified cache entry .
 * @ param requestInfo request info ( cache key )
 * @ return cache response instance */
protected CacheResponse get ( final CacheEntry requestInfo ) { } }

implementation: if ( ! checkDiskCache ( ) ) { return null ; } final CacheEntry entry = newCacheEntry ( ) ; final DiskLruCache . Snapshot snapshot = readCacheInfo ( requestInfo , entry ) ; if ( snapshot == null ) { return null ; } if ( ! entry . matches ( requestInfo ) || ! entry . canBeUsed ( ) ) { snapshot . close ( ) ; return null ; } hitCount . incrementAndGet ( ) ; final InputStream body = newBodyInputStream ( snapshot ) ; return entry . newCacheResponse ( body ) ;


signature:
public class BaseFileResponseCache { /** * Returns an input stream that reads the body of a snapshot , closing the
 * snapshot when the stream is closed . */
private InputStream newBodyInputStream ( final DiskLruCache . Snapshot snapshot ) { } }

implementation: return new FilterInputStream ( snapshot . getInputStream ( ENTRY_BODY ) ) { @ Override public void close ( ) throws IOException { snapshot . close ( ) ; super . close ( ) ; } } ;


signature:
public class BufferBitmapDecorator { /** * Prepare for new width and hight .
 * @ param width new width
 * @ param height new height */
protected void reset ( final int width , final int height ) { } }

implementation:
Bitmap bitmap = this . bitmap ; // recycle old buffer
if ( bitmap != null ) { bitmap . recycle ( ) ; } bitmap = Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; // high quality
this . bitmap = bitmap ; this . bitmapCanvas = new Canvas ( bitmap ) ;


signature:
public class WebsockifySslContext { /** * Returns the singleton instance for this class */
public static WebsockifySslContext getInstance ( String keystore , String password , String keyPassword ) { } }

implementation: WebsockifySslContext context = SingletonHolder . INSTANCE_MAP . get ( keystore ) ; if ( context == null ) { context = new WebsockifySslContext ( keystore , password , keyPassword ) ; SingletonHolder . INSTANCE_MAP . put ( keystore , context ) ; } return context ;


signature:
public class WebsockifySslContext { /** * Validates that a keystore with the given parameters exists and can be used for an SSL context .
 * @ param keystore - path to the keystore file
 * @ param password - password to the keystore file
 * @ param keyPassword - password to the private key in the keystore file
 * @ return null if valid , otherwise a string describing the error . */
public static void validateKeystore ( String keystore , String password , String keyPassword ) throws KeyManagementException , UnrecoverableKeyException , IOException , NoSuchAlgorithmException , CertificateException , KeyStoreException { } }

implementation: getSSLContext ( keystore , password , keyPassword ) ;


signature:
public class ImageView { /** * This method replaces the scale type of an image view without call to layout requests .
 * @ param type new scale type
 * @ return previous scale type */
public ScaleType replaceScaleType ( final ScaleType type ) { } }

implementation: blockLayoutRequests = true ; final ScaleType result = getScaleType ( ) ; setScaleType ( type ) ; blockLayoutRequests = false ; return result ;


signature:
public class ImageView { /** * Set a scale type and store a previous one that will be restores after the next call to { @ link # setImageDrawable ( Drawable ) } .
 * @ param scaleType */
public void setTemporaryScaleType ( final ScaleType scaleType ) { } }

implementation: final ScaleType old = replaceScaleType ( scaleType ) ; if ( storedScaleType == null ) { storedScaleType = old ; }


signature:
public class LocationBinder { /** * Please call it from the main thread ( with looper ) .
 * @ param context context instance */
public void startListening ( final Context context ) { } }

implementation: if ( DEBUG ) { Log . d ( TAG , "Start location listening..." ) ; } try { locationManager = ( LocationManager ) context . getSystemService ( Context . LOCATION_SERVICE ) ; if ( locationManager == null ) { return ; } } catch ( final Exception e ) { return ; } myHandler = myLooper != null ? new MyHandler ( myLooper ) : new MyHandler ( ) ; if ( listener != null ) { listener . onLocationStart ( ) ; } final Location last = getLastKnown ( locationManager ) ; if ( last != null ) { newLocation ( last ) ; } final Criteria c = new Criteria ( ) ; c . setAltitudeRequired ( false ) ; c . setSpeedRequired ( false ) ; c . setBearingRequired ( false ) ; c . setCostAllowed ( false ) ; c . setPowerRequirement ( Criteria . POWER_LOW ) ; c . setAccuracy ( Criteria . ACCURACY_COARSE ) ; final String coarseProvider = locationManager . getBestProvider ( c , false ) ; c . setPowerRequirement ( Criteria . NO_REQUIREMENT ) ; c . setAccuracy ( Criteria . ACCURACY_FINE ) ; final String fineProvider = locationManager . getBestProvider ( c , false ) ; if ( DEBUG ) { Log . d ( TAG , "Providers " + coarseProvider + "/" + fineProvider ) ; } final long minTime = 60000 ; final int minDistance = 50 ; if ( coarseProvider != null ) { if ( DEBUG ) { Log . d ( TAG , "Register for " + coarseProvider ) ; } locationManager . requestLocationUpdates ( coarseProvider , minTime , minDistance , coarseListener ) ; myHandler . sendEmptyMessageDelayed ( MSG_STOP_COARSE_PROVIDER , MAX_COARSE_PROVIDER_LISTEN_TIME ) ; } if ( fineProvider != null ) { if ( DEBUG ) { Log . d ( TAG , "Register for " + fineProvider ) ; } locationManager . requestLocationUpdates ( fineProvider , minTime , minDistance , fineListener ) ; myHandler . sendEmptyMessageDelayed ( MSG_STOP_FINE_PROVIDER , MAX_FINE_PROVIDER_LISTEN_TIME ) ; }


signature:
public class LocationBinder { /** * Stop updates . */
public void stopListening ( ) { } }

implementation: if ( locationManager == null ) { return ; } if ( DEBUG ) { Log . d ( TAG , "Stop location listening..." ) ; } if ( listener != null ) { listener . onLocationStop ( ) ; } myHandler . removeMessages ( MSG_STOP_FINE_PROVIDER ) ; locationManager . removeUpdates ( coarseListener ) ; locationManager . removeUpdates ( fineListener ) ; locationManager = null ;


signature:
public class ServiceRequestPerformer { /** * Construct a pending intent that can be used for starting request processing .
 * Note that after this method is executed executor of the request builder is always null .
 * @ param requestBuilder request builder instance
 * @ param flags flags to pass to { @ link PendingIntent # getService ( Context , int , Intent , int ) }
 * @ return pending intent for starting request processing */
public PendingIntent getPendingIntent ( final RequestBuilder < ? > requestBuilder , final int flags ) { } }

implementation: return PendingIntent . getService ( context , 0 , getIntent ( requestBuilder ) , flags ) ;


signature:
public class RequestMethod { /** * Perform disconnect actions .
 * @ param connection connection instance ( may be wrapped ) */
protected void disconnect ( final URLConnection connection ) { } }

implementation: final URLConnection http = UrlConnectionWrapper . unwrap ( connection ) ; if ( http instanceof HttpURLConnection ) { ( ( HttpURLConnection ) http ) . disconnect ( ) ; }


signature:
public class ApplicationServiceSupport { /** * Create the service connection . */
public void bind ( ) { } }

implementation:
if ( serviceObject != null ) { return ; } final Context context = contextRef . get ( ) ; if ( context == null ) { return ; } // TODO make it configurable
final Intent intent = new Intent ( context , GoroService . class ) ; intent . setAction ( getInterfaceClass ( ) . getName ( ) ) ; if ( DEBUG_CALLS ) { Log . v ( TAG , "Attempt to bind to service " + this + "/" + context , new RuntimeException ( ) ) ; } // start manually , so that it will be stopped manually
context . startService ( intent ) ; final boolean bindResult = context . bindService ( intent , this , 0 ) ; if ( DEBUG ) { Log . v ( TAG , "Binded to service: " + bindResult + ", " + context + ", interface: " + getInterfaceClass ( ) ) ; }


signature:
public class ApplicationServiceSupport { /** * Destroy the service connection . */
public void unbind ( ) { } }

implementation: if ( serviceObject == null ) { return ; } serviceObject = null ; final Context context = contextRef . get ( ) ; if ( DEBUG ) { Log . v ( TAG , "Unbind " + context + " from " + getInterfaceClass ( ) ) ; } if ( context == null ) { return ; } try { context . unbindService ( this ) ; } catch ( final Exception e ) { if ( DEBUG ) { Log . e ( TAG , "Cannot unbind from application service" , e ) ; } }


signature:
public class ViewImageConsumer { /** * Method should be called when wrapped view gets changes related to this consumer . */
public void notifyAboutViewChanges ( ) { } }

implementation: final T view = this . view ; if ( view != null && view instanceof ImagesLoadListenerProvider ) { this . listener = ( ( ImagesLoadListenerProvider ) view ) . getImagesLoadListener ( ) ; }


signature:
public class DirectProxyHandler { /** * The client won ' t send any message so connect directly on channel open */
@ Override public void channelOpen ( final ChannelHandlerContext ctx , final ChannelStateEvent e ) throws Exception { } }

implementation:
try { // make the proxy connection
ensureTargetConnection ( e . getChannel ( ) , false , null ) ; } catch ( Exception ex ) { // target connection failed , so close the client connection
e . getChannel ( ) . close ( ) ; ex . printStackTrace ( ) ; }


signature:
public class RequestBuilderLoader { /** * Data loading has been successful , we are going to accept data .
 * Here we can implement some accumulation logic .
 * @ param previousData old data
 * @ param responseData new data
 * @ return data to accept */
protected ResponseData < MT > onAcceptData ( final ResponseData < MT > previousData , final ResponseData < MT > responseData ) { } }

implementation: return responseData ;


signature:
public class RequestBuilderLoader { /** * request to completely reset the loader */
@ Override protected void onReset ( ) { } }

implementation: if ( DEBUG ) { Log . v ( TAG , "onReset " + this ) ; } super . onReset ( ) ; onStopLoading ( ) ; if ( receivedResponse != null ) { onReleaseData ( receivedResponse ) ; receivedResponse = null ; }


signature:
public class RequestBuilderLoader { /** * For testing only . */
void waitForLoader ( final long time ) { } }

implementation: try { done . await ( time , TimeUnit . MILLISECONDS ) ; } catch ( final InterruptedException e ) { Log . e ( TAG , "waitForLoader() ininterrupted" , e ) ; }


signature:
public class ImageLoader { /** * main thread */
public boolean addTarget ( final ImageConsumer imageHolder ) { } }

implementation:
if ( future . isCancelled ( ) ) { return false ; } // we should start a new task
imageHolder . onStart ( this , request . url ) ; synchronized ( targets ) { if ( result != null ) { imagesManager . setResultImage ( imageHolder , result , false ) ; imageHolder . onFinish ( request . url , result ) ; } else if ( error != null ) { imageHolder . onError ( request . url , error ) ; } else { imageHolder . currentLoader = this ; targets . add ( imageHolder ) ; } } return true ;


signature:
public class ImageLoader { /** * main thread */
public void removeTarget ( final ImageConsumer consumer ) { } }

implementation: if ( imagesManager . debug ) { Log . d ( TAG , "Cancel request: " + request . getKey ( ) + "\nLoader: " + this ) ; } consumer . onCancel ( request . url ) ; synchronized ( targets ) { targets . remove ( consumer ) ; if ( targets . isEmpty ( ) ) { if ( ! future . cancel ( true ) ) { if ( imagesManager . debug ) { Log . d ( TAG , "Can't cancel task so let's try to remove loader manually" ) ; } imagesManager . currentLoads . remove ( request . getKey ( ) , this ) ; } } }


signature:
public class ImageLoader { /** * worker thread */
private void safeImageSet ( final ImageResult result ) { } }

implementation:
if ( imagesManager . debug ) { Log . v ( ImagesManager . TAG , "Post setting drawable for " + request . getKey ( ) ) ; } synchronized ( targets ) { if ( this . result != null ) { throw new IllegalStateException ( "Result is already set" ) ; } memCacheImage ( result ) ; this . result = result ; } post ( new Runnable ( ) { @ Override public void run ( ) { if ( imagesManager . debug ) { Log . v ( TAG , "Set drawable for " + request . getKey ( ) ) ; } final ArrayList < ImageConsumer > targets = ImageLoader . this . targets ; final int count = targets . size ( ) ; if ( count > 0 ) { // noinspection ForLoopReplaceableByForEach
for ( int i = 0 ; i < count ; i ++ ) { final ImageConsumer imageHolder = targets . get ( i ) ; if ( imagesManager . debug ) { Log . d ( TAG , "Try to set " + imageHolder + " - " + request . getKey ( ) ) ; } setToConsumer ( imageHolder , result ) ; } } else if ( imagesManager . debug ) { Log . w ( TAG , "set drawable: have no targets in list" ) ; } } } ) ;


signature:
public class ImageLoader { /** * main thread */
private void setToConsumer ( final ImageConsumer consumer , final ImageResult result ) { } }

implementation: if ( consumer . currentLoader == this ) { imagesManager . setResultImage ( consumer , result , true ) ; } else { if ( imagesManager . debug ) { Log . d ( TAG , "Skip set for " + consumer ) ; } }


signature:
public class GUIUtils { /** * Set text view value or set its visibility to { @ link View # GONE } .
 * @ param view view instance
 * @ param text text value */
public static void setTextOrHide ( final TextView view , final CharSequence text ) { } }

implementation: setTextOrHide ( view , text , View . GONE ) ;


signature:
public class GUIUtils { /** * Set text view value or change its visibility in case of empty value .
 * @ param view view instance
 * @ param text text value
 * @ param hvisibility visibility value */
public static void setTextOrHide ( final TextView view , final CharSequence text , final int hvisibility ) { } }

implementation: if ( TextUtils . isEmpty ( text ) ) { view . setVisibility ( hvisibility ) ; } else { view . setText ( text ) ; view . setVisibility ( View . VISIBLE ) ; }


signature:
public class GUIUtils { /** * Hide soft keyboard .
 * @ param textView text view containing current window token */
public static void hideSoftInput ( final View textView ) { } }

implementation: try { final InputMethodManager imm = ( InputMethodManager ) textView . getContext ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; imm . hideSoftInputFromWindow ( textView . getWindowToken ( ) , 0 ) ; } catch ( final Exception e ) { Log . w ( TAG , "Ignore exception" , e ) ; }


signature:
public class GUIUtils { /** * Show soft keyboard .
 * @ param textView text view containing current window token */
public static void showSoftInput ( final View textView ) { } }

implementation: try { final InputMethodManager imm = ( InputMethodManager ) textView . getContext ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; imm . showSoftInput ( textView , InputMethodManager . SHOW_FORCED ) ; } catch ( final Exception e ) { Log . w ( TAG , "Ignore exception" , e ) ; }


signature:
public class GUIUtils { /** * Toggles keyboard visibility .
 * @ param textView text view containing current window token */
public static void toggleSoftInput ( final View textView ) { } }

implementation: try { final InputMethodManager imm = ( InputMethodManager ) textView . getContext ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; imm . toggleSoftInputFromWindow ( textView . getWindowToken ( ) , 0 , 0 ) ; } catch ( final Exception e ) { Log . w ( TAG , "Ignore exception" , e ) ; }


signature:
public class GUIUtils { /** * Converts device independent points to actual pixels .
 * @ param displayMetrics display metrics
 * @ param dip dip value
 * @ return pixels count */
public static int pixelsWidth ( final DisplayMetrics displayMetrics , final int dip ) { } }

implementation: final float scale = displayMetrics . density ; final float alpha = 0.5f ; return ( int ) ( dip * scale + alpha ) ;


signature:
public class GUIUtils { /** * Find view by ID .
 * @ param view view to start search
 * @ param id view identifier
 * @ param < T > view type
 * @ return view instance , null if nothing was found
 * @ see View # findViewById ( int ) */
@ SuppressWarnings ( "unchecked" ) public static < T extends View > T find ( final View view , final int id ) { } }

implementation: final View result = view . findViewById ( id ) ; return ( T ) result ;


signature:
public class GUIUtils { /** * Find view by ID .
 * @ param activity activity to search in
 * @ param id view identifier
 * @ param < T > view type
 * @ return view instance , null if nothing was found
 * @ see Activity # findViewById ( int ) */
@ SuppressWarnings ( "unchecked" ) public static < T extends View > T find ( final Activity activity , final int id ) { } }

implementation: final View result = activity . findViewById ( id ) ; return ( T ) result ;


signature:
public class PortUnificationHandler { /** * cancel the timer if exception is caught - prevents useless stack traces */
@ Override public void exceptionCaught ( ChannelHandlerContext ctx , ExceptionEvent e ) throws Exception { } }

implementation: cancelDirectConnectionTimer ( ) ; Logger . getLogger ( PortUnificationHandler . class . getName ( ) ) . severe ( "Exception on connection to " + ctx . getChannel ( ) . getRemoteAddress ( ) + ": " + e . getCause ( ) . getMessage ( ) ) ;


signature:
public class MarkableInputStream { /** * Returns an opaque token representing the current position in the stream .
 * Call { @ link # reset ( long ) } to return to this position in the stream later .
 * It is an error to call { @ link # reset ( long ) } after consuming more than
 * { @ code readLimit } bytes from this stream . */
public long savePosition ( int readLimit ) { } }

implementation: long offsetLimit = offset + readLimit ; if ( limit < offsetLimit ) { setLimit ( offsetLimit ) ; } return offset ;


signature:
public class MarkableInputStream { /** * Makes sure that the underlying stream can backtrack the full range from
 * { @ code reset } thru { @ code limit } . Since we can ' t call { @ code mark ( ) }
 * without also adjusting the reset - to - position on the underlying stream this
 * method resets first and then marks the union of the two byte ranges . On
 * buffered streams this additional cursor motion shouldn ' t result in any
 * additional I / O . */
private void setLimit ( long limit ) { } }

implementation: try { if ( reset < offset && offset <= this . limit ) { in . reset ( ) ; in . mark ( ( int ) ( limit - reset ) ) ; skip ( reset , offset ) ; } else { reset = offset ; in . mark ( ( int ) ( limit - offset ) ) ; } this . limit = limit ; } catch ( IOException e ) { throw new IllegalStateException ( "Unable to mark: " + e ) ; }


signature:
public class MarkableInputStream { /** * Resets the stream to the position recorded by { @ code token } . */
public void reset ( long token ) throws IOException { } }

implementation: if ( offset > limit || token < reset ) { throw new IOException ( "Cannot reset" ) ; } in . reset ( ) ; skip ( reset , token ) ; offset = token ;


signature:
public class MarkableInputStream { /** * Skips { @ code target - current } bytes and returns . */
private void skip ( long current , long target ) throws IOException { } }

implementation: while ( current < target ) { long skipped = in . skip ( target - current ) ; current += skipped ; }


signature:
public class ImagesManager { /** * Clear the cached entities .
 * @ param url image URL
 * @ return true if entry was deleted */
public boolean clearCache ( final String url ) { } }

implementation: memCache . remove ( url ) ; try { return imagesResponseCache . deleteGetEntry ( url ) ; } catch ( final IOException e ) { Log . w ( TAG , "Cannot clear disk cache for " + url , e ) ; return false ; }


signature:
public class ImagesManager { /** * Populate the requested image to the specified view . Called from the GUI thread .
 * @ param view view instance
 * @ param url image URL */
public void populateImage ( final View view , final String url ) { } }

implementation: final Object tag = view . getTag ( ) ; ImageConsumer consumer = null ; if ( tag == null ) { consumer = createImageConsumer ( view ) ; view . setTag ( consumer ) ; } else { if ( ! ( tag instanceof ImageConsumer ) ) { throw new IllegalStateException ( "View already has a tag " + tag + ". Cannot store consumer" ) ; } consumer = ( ImageConsumer ) tag ; } populateImage ( consumer , url ) ;


signature:
public class ImagesManager { /** * Cancel image loading for a view .
 * @ param view view that hold an image */
public void cancelImageLoading ( final View view ) { } }

implementation: checkThread ( ) ; final Object tag = view . getTag ( ) ; if ( tag != null && tag instanceof ImageConsumer ) { cancelImageLoading ( ( ImageConsumer ) tag ) ; }


signature:
public class ImagesManager { /** * Create an image holder instance for the defined view .
 * @ param view view instance
 * @ return image holder instance */
protected ImageConsumer createImageConsumer ( final View view ) { } }

implementation: if ( this . consumerFactory == null ) { throw new IllegalStateException ( "Image consumers factory bean not found in container. Take a look at DefaultBeansManager.edit().images() method in assist package." ) ; } return consumerFactory . createConsumer ( view ) ;


signature:
public class ImagesManager { /** * It must be executed in the main thread .
 * @ param consumer image consumer
 * @ param result result instance
 * @ param animate whether to animate image change */
protected final void setResultImage ( final ImageConsumer consumer , final ImageResult result , final boolean animate ) { } }

implementation: decorateResult ( consumer , result ) ; consumer . setImage ( createDrawable ( result . getBitmap ( ) ) , animate ) ; consumer . reset ( ) ;


signature:
public class ImagesManager { /** * Set preloader .
 * @ param consumer image consumer instance */
private void setLoadingImage ( final ImageConsumer consumer ) { } }

implementation: if ( ! consumer . skipLoadingImage ( ) ) { Drawable d = getLoadingDrawable ( consumer ) ; if ( ! consumer . hasUndefinedSize ( ) || ( d . getIntrinsicWidth ( ) != 0 && d . getIntrinsicHeight ( ) != 0 ) ) { consumer . setLoadingImage ( d ) ; } }


signature:
public class ImagesManager { /** * Executed in the main thread .
 * @ param request image request
 * @ param consumer image holder to process */
private void startImageLoaderTask ( final ImageConsumer consumer , final ImageRequest request ) { } }

implementation: final String key = request . getKey ( ) ; if ( debug ) { Log . d ( TAG , "Key " + key ) ; } ImageLoader loader = currentLoads . get ( key ) ; if ( loader != null ) { final boolean added = loader . addTarget ( consumer ) ; if ( ! added ) { loader = null ; } } if ( loader == null ) { if ( debug ) { Log . d ( TAG , "Start a new task" ) ; } loader = new ImageLoader ( request , this ) ; if ( ! loader . addTarget ( consumer ) ) { throw new IllegalStateException ( "Cannot add target to the new loader" ) ; } currentLoads . put ( key , loader ) ; if ( debug ) { Log . d ( TAG , "Current loaders count: " + currentLoads . size ( ) ) ; } final Executor executor = getImageTaskExecutor ( ) ; executor . execute ( loader . future ) ; } else if ( debug ) { Log . d ( TAG , "Joined to the existing task " + key ) ; }


signature:
public class ImagesManager { /** * Add image to memory cache .
 * @ param url image URL
 * @ param bitmap bitmap */
protected void memCacheImage ( final String url , final Bitmap bitmap ) { } }

implementation: if ( debug ) { Log . d ( TAG , "Memcache for " + url ) ; } memCache . putElement ( url , bitmap ) ;


signature:
public class BaseContentHandler { /** * Checks the raw type provided by the token an presence of { @ link Model } annotation on it .
 * @ param modelType model type token
 * @ return Java type */
protected Type getModelType ( final EntityTypeToken modelType ) { } }

implementation:
final Class < ? > modelClass = modelType . getRawClass ( ) ; // check for wrappers
final Model modelAnnotation = modelClass . getAnnotation ( Model . class ) ; if ( modelAnnotation == null ) { return modelType . getType ( ) ; } final Class < ? > wrapper = modelAnnotation . wrapper ( ) ; return wrapper != null && wrapper != Model . class ? wrapper : modelType . getType ( ) ;


signature:
public class BuffersPool { /** * Recycle the buffer .
 * @ param buffer unused buffer */
public void release ( final byte [ ] buffer ) { } }

implementation: if ( buffer == null ) { return ; } final int capacity = buffer . length ; if ( capacity == 0 ) { return ; } synchronized ( lock ) { List < Object > bList = buffers . get ( capacity ) ; if ( bList == null ) { bList = new LinkedList < Object > ( ) ; buffers . put ( capacity , bList ) ; } bList . add ( buffer ) ; usedBuffersCount -- ; }


signature:
public class RequestDescription { /** * A good place to set custom request headers .
 * @ param context system context
 * @ param urlConnection URL connection instance */
protected void onURLConnectionPrepared ( final Context context , final URLConnection urlConnection ) { } }

implementation: if ( contentType != null ) { urlConnection . addRequestProperty ( "Content-Type" , contentType ) ; } if ( contentLanguage != null ) { urlConnection . addRequestProperty ( "Accept-Language" , contentLanguage ) ; } urlConnection . addRequestProperty ( "Accept-Encoding" , IoUtils . ENCODING_GZIP ) ; urlConnection . addRequestProperty ( "User-Agent" , buildUserAgent ( context ) ) ; if ( headers != null ) { for ( String name : headers . keySet ( ) ) { urlConnection . addRequestProperty ( name , headers . getString ( name ) ) ; } }


signature:
public class RequestDescription { /** * Build { @ link URLConnection } instance , connect , write request .
 * @ param context context instance
 * @ return { @ link URLConnection } instance , ready for { @ link URLConnection # getInputStream ( ) } call
 * @ throws IOException in case of I / O errors */
public URLConnection makeConnection ( final Context context ) throws IOException { } }

implementation:
ConverterFactory factory = CONVERTER_FACTORIES . get ( operationType ) ; if ( factory == null ) { throw new IllegalArgumentException ( "Don't know how to convert operation type " + operationType ) ; } final BaseRequestDescriptionConverter converter = factory . createConverter ( this , context ) ; // create instance
final URLConnection connection = converter . prepareConnectionInstance ( ) ; // setup headers
onURLConnectionPrepared ( context , connection ) ; // make a connection
converter . connect ( connection ) ; // send data , if required
converter . sendRequest ( connection ) ; return connection ;


signature:
public class SimpleRequestBuilder { /** * Add string parameter .
 * @ param name parameter name
 * @ param value parameter value
 * @ return this builder for chaining */
public SimpleRequestBuilder < MT > addParam ( final String name , final String value ) { } }

implementation: addSimpleParameter ( name , value ) ; return this ;


signature:
public class CacheControlUrlConnection { /** * XXX on 2.3 we get NP exception in case of HTTPs connection and cache */
private void connectWithWorkaround ( ) throws IOException { } }

implementation:
if ( Build . VERSION . SDK_INT > Build . VERSION_CODES . GINGERBREAD_MR1 ) { super . connect ( ) ; return ; } URLConnection coreConnection = UrlConnectionWrapper . unwrap ( getCore ( ) ) ; if ( coreConnection instanceof HttpsURLConnection ) { // CHECKSTYLE : OFF
try { super . connect ( ) ; } catch ( NullPointerException e ) { // ignore this NP
} // CHECKSTYLE : ON
} else { super . connect ( ) ; }


signature:
public class Md5 { /** * Calculate 32 bytes length MD5 digest .
 * @ param text input text
 * @ return MD5 digest */
public static String getMd5 ( final String text ) { } }

implementation: try { final MessageDigest md = MessageDigest . getInstance ( "MD5" ) ; final byte [ ] utf8Bytes = text . getBytes ( UTF_8_NAME ) ; md . update ( utf8Bytes , 0 , utf8Bytes . length ) ; final byte [ ] md5hash = md . digest ( ) ; final int radix = 16 ; final int length = 32 ; final StringBuilder result = new StringBuilder ( length ) . append ( new BigInteger ( 1 , md5hash ) . toString ( radix ) ) ; final int zeroBeginLen = length - result . length ( ) ; if ( zeroBeginLen > 0 ) { final char [ ] zeroBegin = new char [ zeroBeginLen ] ; Arrays . fill ( zeroBegin , Character . forDigit ( 0 , radix ) ) ; result . insert ( 0 , zeroBegin ) ; } return result . toString ( ) ; } catch ( final NoSuchAlgorithmException | UnsupportedEncodingException e ) { throw new AssertionError ( e ) ; }


signature:
public class SharingHelper { /** * Check whether activity contains a sharing intent previously set with { @ link # setSharingIntent ( Intent , Intent ) }
 * and process it with { @ link # processSharingIntent ( Intent ) } if result is positive .
 * Anyway activity intent will not contain a sharing extra after this method execution .
 * @ param activity activity instance
 * @ return whether sharing extra has been put to the activity intent */
public boolean checkSharingIntent ( final Activity activity ) { } }

implementation: final Intent activityIntent = activity . getIntent ( ) ; if ( activityIntent . hasExtra ( SharingHelper . EXTRA_SHARING ) ) { processSharingIntent ( activityIntent . < Intent > getParcelableExtra ( SharingHelper . EXTRA_SHARING ) ) ; activityIntent . removeExtra ( SharingHelper . EXTRA_SHARING ) ; return true ; } return false ;


signature:
public class UploadPostConverter { /** * / * From MultipartEntity */
private static byte [ ] generateMultipartBoundary ( ) { } }

implementation:
final Random rand = new Random ( ) ; final int c11 = 11 , c30 = 30 ; final byte [ ] bytes = new byte [ rand . nextInt ( c11 ) + c30 ] ; // a random size from 30 to 40
final byte [ ] chars = getMultipartChars ( ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { bytes [ i ] = chars [ rand . nextInt ( chars . length ) ] ; } return bytes ;


signature:
public class cublasGemmAlgo { /** * Returns a string representation of the given constant
 * @ return A string representation of the given constant */
public static String stringFor ( int n ) { } }

implementation: switch ( n ) { case CUBLAS_GEMM_DEFAULT : return "CUBLAS_GEMM_DEFAULT" ; case CUBLAS_GEMM_ALGO0 : return "CUBLAS_GEMM_ALGO0" ; case CUBLAS_GEMM_ALGO1 : return "CUBLAS_GEMM_ALGO1" ; case CUBLAS_GEMM_ALGO2 : return "CUBLAS_GEMM_ALGO2" ; case CUBLAS_GEMM_ALGO3 : return "CUBLAS_GEMM_ALGO3" ; case CUBLAS_GEMM_ALGO4 : return "CUBLAS_GEMM_ALGO4" ; case CUBLAS_GEMM_ALGO5 : return "CUBLAS_GEMM_ALGO5" ; case CUBLAS_GEMM_ALGO6 : return "CUBLAS_GEMM_ALGO6" ; case CUBLAS_GEMM_ALGO7 : return "CUBLAS_GEMM_ALGO7" ; case CUBLAS_GEMM_ALGO8 : return "CUBLAS_GEMM_ALGO8" ; case CUBLAS_GEMM_ALGO9 : return "CUBLAS_GEMM_ALGO9" ; case CUBLAS_GEMM_ALGO10 : return "CUBLAS_GEMM_ALGO10" ; case CUBLAS_GEMM_ALGO11 : return "CUBLAS_GEMM_ALGO11" ; case CUBLAS_GEMM_ALGO12 : return "CUBLAS_GEMM_ALGO12" ; case CUBLAS_GEMM_ALGO13 : return "CUBLAS_GEMM_ALGO13" ; case CUBLAS_GEMM_ALGO14 : return "CUBLAS_GEMM_ALGO14" ; case CUBLAS_GEMM_ALGO15 : return "CUBLAS_GEMM_ALGO15" ; case CUBLAS_GEMM_ALGO16 : return "CUBLAS_GEMM_ALGO16" ; case CUBLAS_GEMM_ALGO17 : return "CUBLAS_GEMM_ALGO17" ; case CUBLAS_GEMM_ALGO18 : return "CUBLAS_GEMM_ALGO18" ; case CUBLAS_GEMM_ALGO19 : return "CUBLAS_GEMM_ALGO19" ; case CUBLAS_GEMM_ALGO20 : return "CUBLAS_GEMM_ALGO20" ; case CUBLAS_GEMM_ALGO21 : return "CUBLAS_GEMM_ALGO21" ; case CUBLAS_GEMM_ALGO22 : return "CUBLAS_GEMM_ALGO22" ; case CUBLAS_GEMM_ALGO23 : return "CUBLAS_GEMM_ALGO23" ; case CUBLAS_GEMM_DEFAULT_TENSOR_OP : return "CUBLAS_GEMM_DEFAULT_TENSOR_OP" ; case CUBLAS_GEMM_ALGO0_TENSOR_OP : return "CUBLAS_GEMM_ALGO0_TENSOR_OP" ; case CUBLAS_GEMM_ALGO1_TENSOR_OP : return "CUBLAS_GEMM_ALGO1_TENSOR_OP" ; case CUBLAS_GEMM_ALGO2_TENSOR_OP : return "CUBLAS_GEMM_ALGO2_TENSOR_OP" ; case CUBLAS_GEMM_ALGO3_TENSOR_OP : return "CUBLAS_GEMM_ALGO3_TENSOR_OP" ; case CUBLAS_GEMM_ALGO4_TENSOR_OP : return "CUBLAS_GEMM_ALGO4_TENSOR_OP" ; case CUBLAS_GEMM_ALGO5_TENSOR_OP : return "CUBLAS_GEMM_ALGO5_TENSOR_OP" ; case CUBLAS_GEMM_ALGO6_TENSOR_OP : return "CUBLAS_GEMM_ALGO6_TENSOR_OP" ; case CUBLAS_GEMM_ALGO7_TENSOR_OP : return "CUBLAS_GEMM_ALGO7_TENSOR_OP" ; case CUBLAS_GEMM_ALGO8_TENSOR_OP : return "CUBLAS_GEMM_ALGO8_TENSOR_OP" ; case CUBLAS_GEMM_ALGO9_TENSOR_OP : return "CUBLAS_GEMM_ALGO9_TENSOR_OP" ; case CUBLAS_GEMM_ALGO10_TENSOR_OP : return "CUBLAS_GEMM_ALGO10_TENSOR_OP" ; case CUBLAS_GEMM_ALGO11_TENSOR_OP : return "CUBLAS_GEMM_ALGO11_TENSOR_OP" ; case CUBLAS_GEMM_ALGO12_TENSOR_OP : return "CUBLAS_GEMM_ALGO12_TENSOR_OP" ; case CUBLAS_GEMM_ALGO13_TENSOR_OP : return "CUBLAS_GEMM_ALGO13_TENSOR_OP" ; case CUBLAS_GEMM_ALGO14_TENSOR_OP : return "CUBLAS_GEMM_ALGO14_TENSOR_OP" ; } return "INVALID cublasGemmAlgo: " + n ;


signature:
public class cublasStatus { /** * Returns the String identifying the given cublasStatus
 * @ param n The cublasStatus
 * @ return The String identifying the given cublasStatus */
public static String stringFor ( int n ) { } }

implementation: switch ( n ) { case CUBLAS_STATUS_SUCCESS : return "CUBLAS_STATUS_SUCCESS" ; case CUBLAS_STATUS_NOT_INITIALIZED : return "CUBLAS_STATUS_NOT_INITIALIZED" ; case CUBLAS_STATUS_ALLOC_FAILED : return "CUBLAS_STATUS_ALLOC_FAILED" ; case CUBLAS_STATUS_INVALID_VALUE : return "CUBLAS_STATUS_INVALID_VALUE" ; case CUBLAS_STATUS_ARCH_MISMATCH : return "CUBLAS_STATUS_ARCH_MISMATCH" ; case CUBLAS_STATUS_MAPPING_ERROR : return "CUBLAS_STATUS_MAPPING_ERROR" ; case CUBLAS_STATUS_EXECUTION_FAILED : return "CUBLAS_STATUS_EXECUTION_FAILED" ; case CUBLAS_STATUS_INTERNAL_ERROR : return "CUBLAS_STATUS_INTERNAL_ERROR" ; case CUBLAS_STATUS_NOT_SUPPORTED : return "CUBLAS_STATUS_NOT_SUPPORTED" ; case JCUBLAS_STATUS_INTERNAL_ERROR : return "JCUBLAS_STATUS_INTERNAL_ERROR" ; } return "INVALID cublasStatus: " + n ;


signature:
public class JCublas2 { /** * If the given result is different to cublasStatus . CUBLAS _ STATUS _ SUCCESS
 * and exceptions have been enabled , this method will throw a
 * CudaException with an error message that corresponds to the
 * given result code . Otherwise , the given result is simply
 * returned .
 * @ param result The result to check
 * @ return The result that was given as the parameter
 * @ throws CudaException If exceptions have been enabled and
 * the given result code is not cublasStatus . CUBLAS _ STATUS _ SUCCESS */
private static int checkResult ( int result ) { } }

implementation: if ( exceptionsEnabled && result != cublasStatus . CUBLAS_STATUS_SUCCESS ) { throw new CudaException ( cublasStatus . stringFor ( result ) ) ; } return result ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasSetVector ( int n , int elemSize , const void * x , int incx ,
 * void * y , int incy )
 * copies n elements from a vector x in CPU memory space to a vector y
 * in GPU memory space . Elements in both vectors are assumed to have a
 * size of elemSize bytes . Storage spacing between consecutive elements
 * is incx for the source vector x and incy for the destination vector
 * y . In general , y points to an object , or part of an object , allocated
 * via cublasAlloc ( ) . Column major format for two - dimensional matrices
 * is assumed throughout CUBLAS . Therefore , if the increment for a vector
 * is equal to 1 , this access a column vector while using an increment
 * equal to the leading dimension of the respective matrix accesses a
 * row vector .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if incx , incy , or elemSize < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if an error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasSetVector ( int n , int elemSize , Pointer x , int incx , Pointer devicePtr , int incy ) { } }

implementation: return checkResult ( cublasSetVectorNative ( n , elemSize , x , incx , devicePtr , incy ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasGetVector ( int n , int elemSize , const void * x , int incx ,
 * void * y , int incy )
 * copies n elements from a vector x in GPU memory space to a vector y
 * in CPU memory space . Elements in both vectors are assumed to have a
 * size of elemSize bytes . Storage spacing between consecutive elements
 * is incx for the source vector x and incy for the destination vector
 * y . In general , x points to an object , or part of an object , allocated
 * via cublasAlloc ( ) . Column major format for two - dimensional matrices
 * is assumed throughout CUBLAS . Therefore , if the increment for a vector
 * is equal to 1 , this access a column vector while using an increment
 * equal to the leading dimension of the respective matrix accesses a
 * row vector .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if incx , incy , or elemSize < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if an error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasGetVector ( int n , int elemSize , Pointer x , int incx , Pointer y , int incy ) { } }

implementation: return checkResult ( cublasGetVectorNative ( n , elemSize , x , incx , y , incy ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasSetMatrix ( int rows , int cols , int elemSize , const void * A ,
 * int lda , void * B , int ldb )
 * copies a tile of rows x cols elements from a matrix A in CPU memory
 * space to a matrix B in GPU memory space . Each element requires storage
 * of elemSize bytes . Both matrices are assumed to be stored in column
 * major format , with the leading dimension ( i . e . number of rows ) of
 * source matrix A provided in lda , and the leading dimension of matrix B
 * provided in ldb . In general , B points to an object , or part of an
 * object , that was allocated via cublasAlloc ( ) .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if rows or cols < 0 , or elemSize , lda , or
 * ldb < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasSetMatrix ( int rows , int cols , int elemSize , Pointer A , int lda , Pointer B , int ldb ) { } }

implementation: return checkResult ( cublasSetMatrixNative ( rows , cols , elemSize , A , lda , B , ldb ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasGetMatrix ( int rows , int cols , int elemSize , const void * A ,
 * int lda , void * B , int ldb )
 * copies a tile of rows x cols elements from a matrix A in GPU memory
 * space to a matrix B in CPU memory space . Each element requires storage
 * of elemSize bytes . Both matrices are assumed to be stored in column
 * major format , with the leading dimension ( i . e . number of rows ) of
 * source matrix A provided in lda , and the leading dimension of matrix B
 * provided in ldb . In general , A points to an object , or part of an
 * object , that was allocated via cublasAlloc ( ) .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if rows , cols , eleSize , lda , or ldb < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasGetMatrix ( int rows , int cols , int elemSize , Pointer A , int lda , Pointer B , int ldb ) { } }

implementation: return checkResult ( cublasGetMatrixNative ( rows , cols , elemSize , A , lda , B , ldb ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus
 * cublasSetVectorAsync ( int n , int elemSize , const void * x , int incx ,
 * void * y , int incy , cudaStream _ t stream ) ;
 * cublasSetVectorAsync has the same functionnality as cublasSetVector
 * but the transfer is done asynchronously within the CUDA stream passed
 * in parameter .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if incx , incy , or elemSize < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if an error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasSetVectorAsync ( int n , int elemSize , Pointer hostPtr , int incx , Pointer devicePtr , int incy , cudaStream_t stream ) { } }

implementation: return checkResult ( cublasSetVectorAsyncNative ( n , elemSize , hostPtr , incx , devicePtr , incy , stream ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus
 * cublasGetVectorAsync ( int n , int elemSize , const void * x , int incx ,
 * void * y , int incy , cudaStream _ t stream )
 * cublasGetVectorAsync has the same functionnality as cublasGetVector
 * but the transfer is done asynchronously within the CUDA stream passed
 * in parameter .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if incx , incy , or elemSize < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if an error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasGetVectorAsync ( int n , int elemSize , Pointer devicePtr , int incx , Pointer hostPtr , int incy , cudaStream_t stream ) { } }

implementation: return checkResult ( cublasGetVectorAsyncNative ( n , elemSize , devicePtr , incx , hostPtr , incy , stream ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasSetMatrixAsync ( int rows , int cols , int elemSize , const void * A ,
 * int lda , void * B , int ldb , cudaStream _ t stream )
 * cublasSetMatrixAsync has the same functionnality as cublasSetMatrix
 * but the transfer is done asynchronously within the CUDA stream passed
 * in parameter .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if rows or cols < 0 , or elemSize , lda , or
 * ldb < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasSetMatrixAsync ( int rows , int cols , int elemSize , Pointer A , int lda , Pointer B , int ldb , cudaStream_t stream ) { } }

implementation: return checkResult ( cublasSetMatrixAsyncNative ( rows , cols , elemSize , A , lda , B , ldb , stream ) ) ;


signature:
public class JCublas2 { /** * < pre >
 * cublasStatus _ t
 * cublasGetMatrixAsync ( int rows , int cols , int elemSize , const void * A ,
 * int lda , void * B , int ldb , cudaStream _ t stream )
 * cublasGetMatrixAsync has the same functionnality as cublasGetMatrix
 * but the transfer is done asynchronously within the CUDA stream passed
 * in parameter .
 * Return Values
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ INVALID _ VALUE if rows , cols , eleSize , lda , or ldb < = 0
 * CUBLAS _ STATUS _ MAPPING _ ERROR if error occurred accessing GPU memory
 * CUBLAS _ STATUS _ SUCCESS if the operation completed successfully
 * < / pre > */
public static int cublasGetMatrixAsync ( int rows , int cols , int elemSize , Pointer A , int lda , Pointer B , int ldb , cudaStream_t stream ) { } }

implementation: return checkResult ( cublasGetMatrixAsyncNative ( rows , cols , elemSize , A , lda , B , ldb , stream ) ) ;


signature:
public class JCublas2 { /** * host or device pointer */
public static int cublasDotEx ( cublasHandle handle , int n , Pointer x , int xType , int incx , Pointer y , int yType , int incy , Pointer result , int resultType , int executionType ) { } }

implementation: return checkResult ( cublasDotExNative ( handle , n , x , xType , incx , y , yType , incy , result , resultType , executionType ) ) ;


signature:
public class JCublas { /** * Obtain the current CUBLAS status by calling cublasGetErrorNative ,
 * and store the result as the lastResult . If the obtained result
 * code is not cublasStatus . CUBLAS _ STATUS _ SUCCESS and exceptions
 * have been enabled , an CudaException will be thrown . */
private static void checkResultBLAS ( ) { } }

implementation: if ( exceptionsEnabled ) { lastResult = cublasGetErrorNative ( ) ; if ( lastResult != cublasStatus . CUBLAS_STATUS_SUCCESS ) { throw new CudaException ( cublasStatus . stringFor ( lastResult ) ) ; } }


signature:
public class JCublas { /** * Wrapper for CUBLAS function . < br / >
 * < br / >
 * cublasStatus
 * cublasAlloc ( int n , int elemSize , void * * devicePtr ) < br / >
 * < br / >
 * creates an object in GPU memory space capable of holding an array of
 * n elements , where each element requires elemSize bytes of storage . If
 * the function call is successful , a pointer to the object in GPU memory
 * space is placed in devicePtr . Note that this is a device pointer that
 * cannot be dereferenced in host code . < br / >
 * < br / >
 * Return Values < br / >
 * - - - - - < br / >
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized < br / >
 * CUBLAS _ STATUS _ INVALID _ VALUE if n < = 0 , or elemSize < = 0 < br / >
 * CUBLAS _ STATUS _ ALLOC _ FAILED if the object could not be allocated due to
 * lack of resources . < br / >
 * CUBLAS _ STATUS _ SUCCESS if storage was successfully allocated < br / > */
public static int cublasAlloc ( int n , int elemSize , Pointer ptr ) { } }

implementation: return checkResult ( cublasAllocNative ( n , elemSize , ptr ) ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a float array containing
 * the complex numbers , where each pair of consecutive numbers in the array
 * describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasSetVector ( int , int , Pointer , int , Pointer , int ) */
public static int cublasSetVector ( int n , cuComplex x [ ] , int offsetx , int incx , Pointer y , int incy ) { } }

implementation: ByteBuffer byteBufferx = ByteBuffer . allocateDirect ( x . length * 4 * 2 ) ; byteBufferx . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer floatBufferx = byteBufferx . asFloatBuffer ( ) ; int indexx = offsetx ; for ( int i = 0 ; i < n ; i ++ , indexx += incx ) { floatBufferx . put ( indexx * 2 + 0 , x [ indexx ] . x ) ; floatBufferx . put ( indexx * 2 + 1 , x [ indexx ] . y ) ; } return checkResult ( cublasSetVectorNative ( n , 8 , Pointer . to ( floatBufferx ) . withByteOffset ( offsetx * 4 * 2 ) , incx , y , incy ) ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a float array that may
 * store the complex numbers , where each pair of consecutive numbers in
 * the array describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasGetVector ( int , int , Pointer , int , Pointer , int ) */
public static int cublasGetVector ( int n , Pointer x , int incx , cuComplex y [ ] , int offsety , int incy ) { } }

implementation: ByteBuffer byteBuffery = ByteBuffer . allocateDirect ( y . length * 4 * 2 ) ; byteBuffery . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer floatBuffery = byteBuffery . asFloatBuffer ( ) ; int status = cublasGetVectorNative ( n , 8 , x , incx , Pointer . to ( floatBuffery ) . withByteOffset ( offsety * 4 * 2 ) , incy ) ; if ( status == cublasStatus . CUBLAS_STATUS_SUCCESS ) { floatBuffery . rewind ( ) ; int indexy = offsety ; for ( int i = 0 ; i < n ; i ++ , indexy += incy ) { y [ indexy ] . x = floatBuffery . get ( indexy * 2 + 0 ) ; y [ indexy ] . y = floatBuffery . get ( indexy * 2 + 1 ) ; } } return checkResult ( status ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a float array containing
 * the complex numbers , where each pair of consecutive numbers in the array
 * describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasSetMatrix ( int , int , int , Pointer , int , Pointer , int ) */
public static int cublasSetMatrix ( int rows , int cols , cuComplex A [ ] , int offsetA , int lda , Pointer B , int ldb ) { } }

implementation: ByteBuffer byteBufferA = ByteBuffer . allocateDirect ( A . length * 4 * 2 ) ; byteBufferA . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer floatBufferA = byteBufferA . asFloatBuffer ( ) ; for ( int i = 0 ; i < A . length ; i ++ ) { floatBufferA . put ( A [ i ] . x ) ; floatBufferA . put ( A [ i ] . y ) ; } return checkResult ( cublasSetMatrixNative ( rows , cols , 8 , Pointer . to ( floatBufferA ) . withByteOffset ( offsetA * 4 * 2 ) , lda , B , ldb ) ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a float array that may
 * store the complex numbers , where each pair of consecutive numbers in
 * the array describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasGetMatrix ( int , int , int , Pointer , int , Pointer , int ) */
public static int cublasGetMatrix ( int rows , int cols , Pointer A , int lda , cuComplex B [ ] , int offsetB , int ldb ) { } }

implementation: ByteBuffer byteBufferB = ByteBuffer . allocateDirect ( B . length * 4 * 2 ) ; byteBufferB . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer floatBufferB = byteBufferB . asFloatBuffer ( ) ; int status = cublasGetMatrixNative ( rows , cols , 8 , A , lda , Pointer . to ( floatBufferB ) . withByteOffset ( offsetB * 4 * 2 ) , ldb ) ; if ( status == cublasStatus . CUBLAS_STATUS_SUCCESS ) { floatBufferB . rewind ( ) ; for ( int c = 0 ; c < cols ; c ++ ) { for ( int r = 0 ; r < rows ; r ++ ) { int index = c * ldb + r + offsetB ; B [ index ] . x = floatBufferB . get ( index * 2 + 0 ) ; B [ index ] . y = floatBufferB . get ( index * 2 + 1 ) ; } } } return checkResult ( status ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuDoubleComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a double array containing
 * the complex numbers , where each pair of consecutive numbers in the array
 * describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasSetVector ( int , int , Pointer , int , Pointer , int ) */
public static int cublasSetVector ( int n , cuDoubleComplex x [ ] , int offsetx , int incx , Pointer y , int incy ) { } }

implementation: ByteBuffer byteBufferx = ByteBuffer . allocateDirect ( x . length * 8 * 2 ) ; byteBufferx . order ( ByteOrder . nativeOrder ( ) ) ; DoubleBuffer doubleBufferx = byteBufferx . asDoubleBuffer ( ) ; int indexx = offsetx ; for ( int i = 0 ; i < n ; i ++ , indexx += incx ) { doubleBufferx . put ( indexx * 2 + 0 , x [ indexx ] . x ) ; doubleBufferx . put ( indexx * 2 + 1 , x [ indexx ] . y ) ; } return checkResult ( cublasSetVectorNative ( n , 16 , Pointer . to ( doubleBufferx ) . withByteOffset ( offsetx * 8 * 2 ) , incx , y , incy ) ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuDoubleComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a double array that may
 * store the complex numbers , where each pair of consecutive numbers in
 * the array describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasGetVector ( int , int , Pointer , int , Pointer , int ) */
public static int cublasGetVector ( int n , Pointer x , int incx , cuDoubleComplex y [ ] , int offsety , int incy ) { } }

implementation: ByteBuffer byteBuffery = ByteBuffer . allocateDirect ( y . length * 8 * 2 ) ; byteBuffery . order ( ByteOrder . nativeOrder ( ) ) ; DoubleBuffer doubleBuffery = byteBuffery . asDoubleBuffer ( ) ; int status = cublasGetVectorNative ( n , 16 , x , incx , Pointer . to ( doubleBuffery ) . withByteOffset ( offsety * 8 * 2 ) , incy ) ; if ( status == cublasStatus . CUBLAS_STATUS_SUCCESS ) { doubleBuffery . rewind ( ) ; int indexy = offsety ; for ( int i = 0 ; i < n ; i ++ , indexy += incy ) { y [ indexy ] . x = doubleBuffery . get ( indexy * 2 + 0 ) ; y [ indexy ] . y = doubleBuffery . get ( indexy * 2 + 1 ) ; } } return checkResult ( status ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuDoubleComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a double array containing
 * the complex numbers , where each pair of consecutive numbers in the array
 * describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasSetMatrix ( int , int , int , Pointer , int , Pointer , int ) */
public static int cublasSetMatrix ( int rows , int cols , cuDoubleComplex A [ ] , int offsetA , int lda , Pointer B , int ldb ) { } }

implementation: ByteBuffer byteBufferA = ByteBuffer . allocateDirect ( A . length * 8 * 2 ) ; byteBufferA . order ( ByteOrder . nativeOrder ( ) ) ; DoubleBuffer doubleBufferA = byteBufferA . asDoubleBuffer ( ) ; for ( int i = 0 ; i < A . length ; i ++ ) { doubleBufferA . put ( A [ i ] . x ) ; doubleBufferA . put ( A [ i ] . y ) ; } return checkResult ( cublasSetMatrixNative ( rows , cols , 16 , Pointer . to ( doubleBufferA ) . withByteOffset ( offsetA * 8 * 2 ) , lda , B , ldb ) ) ;


signature:
public class JCublas { /** * Extended wrapper for arrays of cuDoubleComplex values . Note that this method
 * only exists for convenience and compatibility with native C code . It
 * is much more efficient to provide a Pointer to a double array that may
 * store the complex numbers , where each pair of consecutive numbers in
 * the array describes the real - and imaginary part of one complex number .
 * @ see JCublas # cublasGetMatrix ( int , int , int , Pointer , int , Pointer , int ) */
public static int cublasGetMatrix ( int rows , int cols , Pointer A , int lda , cuDoubleComplex B [ ] , int offsetB , int ldb ) { } }

implementation: ByteBuffer byteBufferB = ByteBuffer . allocateDirect ( B . length * 8 * 2 ) ; byteBufferB . order ( ByteOrder . nativeOrder ( ) ) ; DoubleBuffer doubleBufferB = byteBufferB . asDoubleBuffer ( ) ; int status = cublasGetMatrixNative ( rows , cols , 16 , A , lda , Pointer . to ( doubleBufferB ) . withByteOffset ( offsetB * 8 * 2 ) , ldb ) ; if ( status == cublasStatus . CUBLAS_STATUS_SUCCESS ) { doubleBufferB . rewind ( ) ; for ( int c = 0 ; c < cols ; c ++ ) { for ( int r = 0 ; r < rows ; r ++ ) { int index = c * ldb + r + offsetB ; B [ index ] . x = doubleBufferB . get ( index * 2 + 0 ) ; B [ index ] . y = doubleBufferB . get ( index * 2 + 1 ) ; } } } return checkResult ( status ) ;


signature:
public class JCublas { /** * Wrapper for CUBLAS function .
 * < pre >
 * void
 * cublasSrotm ( int n , float * x , int incx , float * y , int incy ,
 * const float * sparam )
 * applies the modified Givens transformation , h , to the 2 x n matrix
 * ( transpose ( x ) )
 * ( transpose ( y ) )
 * The elements of x are in x [ lx + i * incx ] , i = 0 to n - 1 , where lx = 1 if
 * incx > = 0 , else lx = 1 + ( 1 - n ) * incx , and similarly for y using ly and
 * incy . With sparam [ 0 ] = sflag , h has one of the following forms :
 * sflag = - 1.0f sflag = 0.0f sflag = 1.0f sflag = - 2.0f
 * ( sh00 sh01 ) ( 1.0f sh01 ) ( sh00 1.0f ) ( 1.0f 0.0f )
 * ( sh10 sh11 ) ( sh10 1.0f ) ( - 1.0f sh11 ) ( 0.0f 1.0f )
 * Input
 * n number of elements in input vectors
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * y single precision vector with n elements
 * incy storage spacing between elements of y
 * sparam 5 - element vector . sparam [ 0 ] is sflag described above . sparam [ 1]
 * through sparam [ 4 ] contain the 2x2 rotation matrix h : sparam [ 1]
 * contains sh00 , sparam [ 2 ] contains sh10 , sparam [ 3 ] contains sh01,
 * and sprams [ 4 ] contains sh11.
 * Output
 * x rotated vector x ( unchanged if n < = 0)
 * y rotated vector y ( unchanged if n < = 0)
 * Reference : http : / / www . netlib . org / blas / srotm . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static void cublasSrotm ( int n , Pointer x , int incx , Pointer y , int incy , float sparam [ ] ) { } }

implementation: cublasSrotmNative ( n , x , incx , y , incy , sparam ) ; checkResultBLAS ( ) ;


signature:
public class JCublas { /** * Wrapper for CUBLAS function .
 * < pre >
 * void
 * cublasSrotmg ( float * psd1 , float * psd2 , float * psx1 , const float * psy1,
 * float * sparam )
 * constructs the modified Givens transformation matrix h which zeros
 * the second component of the 2 - vector transpose ( sqrt ( sd1 ) * sx1 , sqrt ( sd2 ) * sy1 ) .
 * With sparam [ 0 ] = sflag , h has one of the following forms :
 * sflag = - 1.0f sflag = 0.0f sflag = 1.0f sflag = - 2.0f
 * ( sh00 sh01 ) ( 1.0f sh01 ) ( sh00 1.0f ) ( 1.0f 0.0f )
 * ( sh10 sh11 ) ( sh10 1.0f ) ( - 1.0f sh11 ) ( 0.0f 1.0f )
 * sparam [ 1 ] through sparam [ 4 ] contain sh00 , sh10 , sh01 , sh11,
 * respectively . Values of 1.0f , - 1.0f , or 0.0f implied by the value
 * of sflag are not stored in sparam .
 * Input
 * sd1 single precision scalar
 * sd2 single precision scalar
 * sx1 single precision scalar
 * sy1 single precision scalar
 * Output
 * sd1 changed to represent the effect of the transformation
 * sd2 changed to represent the effect of the transformation
 * sx1 changed to represent the effect of the transformation
 * sparam 5 - element vector . sparam [ 0 ] is sflag described above . sparam [ 1]
 * through sparam [ 4 ] contain the 2x2 rotation matrix h : sparam [ 1]
 * contains sh00 , sparam [ 2 ] contains sh10 , sparam [ 3 ] contains sh01,
 * and sprams [ 4 ] contains sh11.
 * Reference : http : / / www . netlib . org / blas / srotmg . f
 * This functions does not set any error status .
 * < / pre > */
public static void cublasSrotmg ( float sd1 [ ] , float sd2 [ ] , float sx1 [ ] , float sy1 , float sparam [ ] ) { } }

implementation: cublasSrotmgNative ( sd1 , sd2 , sx1 , sy1 , sparam ) ; checkResultBLAS ( ) ;


signature:
public class JCublas { /** * Wrapper for CUBLAS function .
 * < pre >
 * void
 * cublasDrotm ( int n , double * x , int incx , double * y , int incy ,
 * const double * sparam )
 * applies the modified Givens transformation , h , to the 2 x n matrix
 * ( transpose ( x ) )
 * ( transpose ( y ) )
 * The elements of x are in x [ lx + i * incx ] , i = 0 to n - 1 , where lx = 1 if
 * incx > = 0 , else lx = 1 + ( 1 - n ) * incx , and similarly for y using ly and
 * incy . With sparam [ 0 ] = sflag , h has one of the following forms :
 * sflag = - 1.0 sflag = 0.0 sflag = 1.0 sflag = - 2.0
 * ( sh00 sh01 ) ( 1.0 sh01 ) ( sh00 1.0 ) ( 1.0 0.0)
 * ( sh10 sh11 ) ( sh10 1.0 ) ( - 1.0 sh11 ) ( 0.0 1.0)
 * Input
 * n number of elements in input vectors
 * x double - precision vector with n elements
 * incx storage spacing between elements of x
 * y double - precision vector with n elements
 * incy storage spacing between elements of y
 * sparam 5 - element vector . sparam [ 0 ] is sflag described above . sparam [ 1]
 * through sparam [ 4 ] contain the 2x2 rotation matrix h : sparam [ 1]
 * contains sh00 , sparam [ 2 ] contains sh10 , sparam [ 3 ] contains sh01,
 * and sprams [ 4 ] contains sh11.
 * Output
 * x rotated vector x ( unchanged if n < = 0)
 * y rotated vector y ( unchanged if n < = 0)
 * Reference : http : / / www . netlib . org / blas / drotm . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ ARCH _ MISMATCH if invoked on device without DP support
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static void cublasDrotm ( int n , Pointer x , int incx , Pointer y , int incy , double sparam [ ] ) { } }

implementation: cublasDrotmNative ( n , x , incx , y , incy , sparam ) ; checkResultBLAS ( ) ;


signature:
public class JCublas { /** * Wrapper for CUBLAS function .
 * < pre >
 * void
 * cublasDrotmg ( double * psd1 , double * psd2 , double * psx1 , const double * psy1,
 * double * sparam )
 * constructs the modified Givens transformation matrix h which zeros
 * the second component of the 2 - vector transpose ( sqrt ( sd1 ) * sx1 , sqrt ( sd2 ) * sy1 ) .
 * With sparam [ 0 ] = sflag , h has one of the following forms :
 * sflag = - 1.0 sflag = 0.0 sflag = 1.0 sflag = - 2.0
 * ( sh00 sh01 ) ( 1.0 sh01 ) ( sh00 1.0 ) ( 1.0 0.0)
 * ( sh10 sh11 ) ( sh10 1.0 ) ( - 1.0 sh11 ) ( 0.0 1.0)
 * sparam [ 1 ] through sparam [ 4 ] contain sh00 , sh10 , sh01 , sh11,
 * respectively . Values of 1.0 , - 1.0 , or 0.0 implied by the value
 * of sflag are not stored in sparam .
 * Input
 * sd1 single precision scalar
 * sd2 single precision scalar
 * sx1 single precision scalar
 * sy1 single precision scalar
 * Output
 * sd1 changed to represent the effect of the transformation
 * sd2 changed to represent the effect of the transformation
 * sx1 changed to represent the effect of the transformation
 * sparam 5 - element vector . sparam [ 0 ] is sflag described above . sparam [ 1]
 * through sparam [ 4 ] contain the 2x2 rotation matrix h : sparam [ 1]
 * contains sh00 , sparam [ 2 ] contains sh10 , sparam [ 3 ] contains sh01,
 * and sprams [ 4 ] contains sh11.
 * Reference : http : / / www . netlib . org / blas / drotmg . f
 * This functions does not set any error status .
 * < / pre > */
public static void cublasDrotmg ( double sd1 [ ] , double sd2 [ ] , double sx1 [ ] , double sy1 , double sparam [ ] ) { } }

implementation: cublasDrotmgNative ( sd1 , sd2 , sx1 , sy1 , sparam ) ; checkResultBLAS ( ) ;


signature:
public class JCublas { /** * < pre >
 * int
 * cublasIsamax ( int n , const float * x , int incx )
 * finds the smallest index of the maximum magnitude element of single
 * precision vector x ; that is , the result is the first i , i = 0 to n - 1,
 * that maximizes abs ( x [ 1 + i * incx ] ) ) .
 * Input
 * n number of elements in input vector
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * Output
 * returns the smallest index ( 0 if n < = 0 or incx < = 0)
 * Reference : http : / / www . netlib . org / blas / isamax . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static int cublasIsamax ( int n , Pointer x , int incx ) { } }

implementation: int result = cublasIsamaxNative ( n , x , incx ) ; checkResultBLAS ( ) ; return result ;


signature:
public class JCublas { /** * < pre >
 * int
 * cublasIsamin ( int n , const float * x , int incx )
 * finds the smallest index of the minimum magnitude element of single
 * precision vector x ; that is , the result is the first i , i = 0 to n - 1,
 * that minimizes abs ( x [ 1 + i * incx ] ) ) .
 * Input
 * n number of elements in input vector
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * Output
 * returns the smallest index ( 0 if n < = 0 or incx < = 0)
 * Reference : http : / / www . netlib . org / scilib / blass . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static int cublasIsamin ( int n , Pointer x , int incx ) { } }

implementation: int result = cublasIsaminNative ( n , x , incx ) ; checkResultBLAS ( ) ; return result ;


signature:
public class JCublas { /** * < pre >
 * float
 * cublasSasum ( int n , const float * x , int incx )
 * computes the sum of the absolute values of the elements of single
 * precision vector x ; that is , the result is the sum from i = 0 to n - 1 of
 * abs ( x [ 1 + i * incx ] ) .
 * Input
 * n number of elements in input vector
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * Output
 * returns the single precision sum of absolute values
 * ( 0 if n < = 0 or incx < = 0 , or if an error occurs )
 * Reference : http : / / www . netlib . org / blas / sasum . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static float cublasSasum ( int n , Pointer x , int incx ) { } }

implementation: float result = cublasSasumNative ( n , x , incx ) ; checkResultBLAS ( ) ; return result ;


signature:
public class JCublas { /** * < pre >
 * void
 * cublasSaxpy ( int n , float alpha , const float * x , int incx , float * y ,
 * int incy )
 * multiplies single precision vector x by single precision scalar alpha
 * and adds the result to single precision vector y ; that is , it overwrites
 * single precision y with single precision alpha * x + y . For i = 0 to n - 1,
 * it replaces y [ ly + i * incy ] with alpha * x [ lx + i * incx ] + y [ ly + i *
 * incy ] , where lx = 1 if incx > = 0 , else lx = 1 + ( 1 - n ) * incx , and ly is
 * defined in a similar way using incy .
 * Input
 * n number of elements in input vectors
 * alpha single precision scalar multiplier
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * y single precision vector with n elements
 * incy storage spacing between elements of y
 * Output
 * y single precision result ( unchanged if n < = 0)
 * Reference : http : / / www . netlib . org / blas / saxpy . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static void cublasSaxpy ( int n , float alpha , Pointer x , int incx , Pointer y , int incy ) { } }

implementation: cublasSaxpyNative ( n , alpha , x , incx , y , incy ) ; checkResultBLAS ( ) ;


signature:
public class JCublas { /** * < pre >
 * void
 * cublasScopy ( int n , const float * x , int incx , float * y , int incy )
 * copies the single precision vector x to the single precision vector y . For
 * i = 0 to n - 1 , copies x [ lx + i * incx ] to y [ ly + i * incy ] , where lx = 1 if
 * incx > = 0 , else lx = 1 + ( 1 - n ) * incx , and ly is defined in a similar
 * way using incy .
 * Input
 * n number of elements in input vectors
 * x single precision vector with n elements
 * incx storage spacing between elements of x
 * y single precision vector with n elements
 * incy storage spacing between elements of y
 * Output
 * y contains single precision vector x
 * Reference : http : / / www . netlib . org / blas / scopy . f
 * Error status for this function can be retrieved via cublasGetError ( ) .
 * Error Status
 * CUBLAS _ STATUS _ NOT _ INITIALIZED if CUBLAS library has not been initialized
 * CUBLAS _ STATUS _ EXECUTION _ FAILED if function failed to launch on GPU
 * < / pre > */
public static void cublasScopy ( int n , Pointer x , int incx , Pointer y , int incy ) { } }

implementation: cublasScopyNative ( n , x , incx , y , incy ) ; checkResultBLAS ( ) ;