Standard Library/android

From J Wiki
Jump to navigation Jump to search
Overview | android | break | colib | compare | coutil | dates | debug | dir | dll | files | jade | jal | stdlib | strings | sysenv | text | unxlib

This script defines android utilities and is included in the J standard library. Definitions are loaded into the z locale.

Definitions

A anddf, andunzip

anddf (verb)

Download a file via android's embedded http client overwriting target file.

Example:

'http://www.jsoftware.com/moin_static180/common/jwlogo.png' anddf jpath'~temp/jwlogo.png'

Syntax:

x anddf y

returns:

>=0 success, number of bytes in file
 _1 unknown error
 _2 target file exists and is not writable
 _3 parent directory is not writable
 _5 malformed url
 _6 i/o exception during transport
 _99 web request returns invalid '0' status code
<= _100 negation of unsuccessful http response code (!=200), ie. _404 "Not Found"

andunzip (verb)

Monadically, it unzips the file at y into the same directory.

Optional x may specify an alternate output directory

Syntax:

andunzip y ; x andunzip y

returns:

 0 success
_1 generic i/o error
_2 zipfile not found
_3 output directory not writable
_4 zip format exception