Returns a [[Java.IO.ByteArrayOutputStream]]
The csv functions are used to read data in a "comma separated values" format (CSV) or other related format such as tab delimited values. These data formats are used to represent data in rows and columns such as a spread sheet or a single database table. See [[CSV]] for more details.
Input to be parsed.
Optional
charset: stringUse with [[Java.IO.InputStream]] to specify it's charset
Assume a CSV file exported from a spreadsheet like this one:
First | Last | Birthday |
Betsy | Ross | 01 - Jan - 1735 |
Alexander | Hamilton | 11 - Jan - 1755 |
Benjamin | Franklin | 17 - Jan - 1706 |
Daniel | Webster | 18 - Jan - 1782 |
const fetcher = B.fetch("http://somedomain.com/birthdays.csv");
const out = "<ul>";
B.csv(fetcher, fetcher.charset)
.forEach(row => {
out += "<li>" + row[0] + " " + row[1] + ": " + row[2] + "</li>";
});
out += "</ul>";
inputStream.close();
The out variable now contains an HTML snippet that looks like this:
A field delimeter and text delimeter can also be specifed for other types of files. For example a tab delimeted file:
B.csv(tsvText)
.fieldDelimeter('\n') //default but specified here as an example
.textDelimeter('\t');
.forEach(row => {
//process row
});
Returns a [[Java.IO.DataHandler]].
Same as calling dataHandler(dataSource(name, contentType, inputStream, outputStream))
Returns a [[Java.IO.DataHandler]].
Same as calling dataHandler(dataSource(settings))
Returns a [[Java.IO.DataSource]].
Returns this scripts draft folder.
Converts a [[Java.IO.InputStream]] to a string.
Optional
charsetname: stringReturns the Stack Trace as a string if e
is a java exception. Else, returns e.toString()
.
Returns the Stack Trace as a string if e
is a java exception. Else, returns e
.
Transforms [[Java.IO.OutputStream]] to a [[Java.IO.GZIPOutputStream]].
Transforms [[Java.IO.Inputstream]] to a [[Java.IO.GZIPInputStream]].
Retrieves a PDF document given the [[Bluestep.Net.FetchedResource]]. If the retrieved resource is not a PDF then it will try to convert it to a PDF. The resulting PDF object can be used to inspect and modify the PDF. Currently only form field values within the PDF can be inspected and modified.
FetchedResource to read the file
Retrieves a PDF document given the [[Java.IO.InputStream]]. If a file suffix is provided, it will try to convert the [[Java.IO.InputStream]] to a PDF. The resulting [[PDFDocument]] can be used to inspect and modify the PDF. Currently only form field values within the PDF can be inspected and modified.
InputStream to read the file.
Optional
fileNameSuffix: stringFile suffix of the [[Java.IO.InputStream]]. Used to help in conversion to pdf. If not provided then the [[Java.IO.InputStream]] is assumed to be a pdf.
Calls console.error(e)
. If e
is a Java.Throwable, then it will generate a stack trace.
Returns this script's draft root folder if debugging otherwise returns snapshot's root folder.
Sends a message. This will send data to the channels and permissions specified in the message object.Javascript on the page can listen to the following example message by using:
bsmsg.listen({channels: ['chat-7348743'], onMessage: msg => { console.log("msg=",msg); }});
Returns this scripts snapshot folder.
Returns a [[Java.IO.StringReader]] that uses a string for the reader's source
Returns a [[Java.IO.StringWriter]] that streams to a string
Return a local url to a created temp file using a callback function providing a [[Java.IO.OutputStream]].
Optional
mimetype: stringConverts a [[Java.IO.InputStream]] to an Java.ByteArray
Return url to created temp file using a callback function providing a [[Java.IO.BufferedWriter]].
Optional
mimetype: stringOptional
charSet: stringConverts a [[Java.ByteArray]] to a [[Java.IO.InputStream]]
Converts a [[Java.ByteArray]] to a [[Java.IO.InputStream]]
Optional
charset: stringConverts a [[Java.IO.InputStream]] to a [[Java.IO.BufferedReader]]
Optional
charsetname: stringConverts a [[Java.IO.OutputStream]] to a [[Java.IO.BufferedWriter]]
Optional
charsetname: stringCreates a zip
Creates a zip
TODO
Return [[Java.IO.ZipInputStream]].
Return [[Java.IO.ZipInputStream]].
Optional
password: string[]Return [[Java.IO.ZipInputStream]].
Creates [[Java.IO.ZipParameters]] for [[Java.IO.ZipOutputStream]].
Creates [[Java.IO.ZipParameters]] for [[Java.IO.ZipOutputStream]] and setting the fileName. Same as calling B.zipParameters().setFileNameInZip(fileName);
Creates [[Java.IO.ZipParameters]] for [[Java.IO.ZipOutputStream]] copied from zipParams.
TODO
Example