a(lineSeparator).shouldNotBeNull(); int[] base64 = Decoder.fromBase64; for (byte b : lineSeparator) {
/** * Wraps an output stream for encoding byte data using the {@link Base64} * encoding scheme. * * <p> It is recommended to promptly close the returned output stream after * use, during which it will flush all possible leftover bytes to the underlying * output stream. Closing the returned output stream will close the underlying * output stream. * * @param os * the output stream. * @return the output stream for encoding the byte data into the * specified Base64 encoded format */ public OutputStream wrap(OutputStream os) { the(os).shouldNotBeNull(); return new EncOutputStream(os, isURL ? toBase64URL : toBase64, newline, linemax, doPadding); }
/** * Returns an input stream for decoding {@link Base64} encoded byte stream. * * <p> The {@code read} methods of the returned {@code InputStream} will * throw {@code IOException} when reading bytes that cannot be decoded. * * <p> Closing the returned input stream will close the underlying * input stream. * * @param is * the input stream * * @return the input stream for decoding the specified Base64 encoded * byte stream */ public InputStream wrap(InputStream is) { the(is).shouldNotBeNull(); return new DecInputStream(is, isURL ? fromBase64URL : fromBase64, isMIME); }
/** * Convenience method to add a non-file form item to request. * Will call {@link #formItem(String, String, boolean, String, byte[])} internally. * Content type will be set to "text/plain", and "isFile" to false. * * @param fieldName name of field - toString() will be used to add to form item * @param value - value of parameter, toString().getBytes() will be used to add to form item * @return @return {@link org.javalite.activeweb.RequestBuilder} for setting additional request parameters. * * @see {@link #formItem(String, String, boolean, String, byte[])} * */ public RequestBuilder formItem(Object fieldName, Object value){ a(fieldName).shouldNotBeNull(); a(value).shouldNotBeNull(); return formItem(fieldName.toString(), fieldName.toString(), false, "text/plain", value.toString().getBytes()); }
/** * Convenience method for sending pairs of name and values with multi-part request. * * @param namesAndValues names and following corresponding values. The following pattern is expected: * name,value,name1,value1... * @return @return {@link org.javalite.activeweb.RequestBuilder} for setting additional request parameters. */ public RequestBuilder formItems(Object ... namesAndValues){ if(namesAndValues.length % 2 != 0) throw new IllegalArgumentException("number of arguments must be even"); for (int i = 0; i < namesAndValues.length - 1; i += 2) { a(namesAndValues[i]).shouldNotBeNull(); a(namesAndValues[i + 1]).shouldNotBeNull(); formItem(namesAndValues[i].toString(), namesAndValues[i].toString(), false, "text/plain", namesAndValues[i + 1].toString().getBytes()); } return this; }
a(lineSeparator).shouldNotBeNull(); int[] base64 = Decoder.fromBase64; for (byte b : lineSeparator) {
/** * Returns an input stream for decoding {@link Base64} encoded byte stream. * * <p> The {@code read} methods of the returned {@code InputStream} will * throw {@code IOException} when reading bytes that cannot be decoded. * * <p> Closing the returned input stream will close the underlying * input stream. * * @param is * the input stream * * @return the input stream for decoding the specified Base64 encoded * byte stream */ public InputStream wrap(InputStream is) { the(is).shouldNotBeNull(); return new DecInputStream(is, isURL ? fromBase64URL : fromBase64, isMIME); }
/** * Wraps an output stream for encoding byte data using the {@link Base64} * encoding scheme. * * <p> It is recommended to promptly close the returned output stream after * use, during which it will flush all possible leftover bytes to the underlying * output stream. Closing the returned output stream will close the underlying * output stream. * * @param os * the output stream. * @return the output stream for encoding the byte data into the * specified Base64 encoded format */ public OutputStream wrap(OutputStream os) { the(os).shouldNotBeNull(); return new EncOutputStream(os, isURL ? toBase64URL : toBase64, newline, linemax, doPadding); }
/** * Wraps an output stream for encoding byte data using the {@link Base64} * encoding scheme. * * <p> It is recommended to promptly close the returned output stream after * use, during which it will flush all possible leftover bytes to the underlying * output stream. Closing the returned output stream will close the underlying * output stream. * * @param os * the output stream. * @return the output stream for encoding the byte data into the * specified Base64 encoded format */ public OutputStream wrap(OutputStream os) { the(os).shouldNotBeNull(); return new EncOutputStream(os, isURL ? toBase64URL : toBase64, newline, linemax, doPadding); }
a(lineSeparator).shouldNotBeNull(); int[] base64 = Decoder.fromBase64; for (byte b : lineSeparator) {
/** * Returns an input stream for decoding {@link Base64} encoded byte stream. * * <p> The {@code read} methods of the returned {@code InputStream} will * throw {@code IOException} when reading bytes that cannot be decoded. * * <p> Closing the returned input stream will close the underlying * input stream. * * @param is * the input stream * * @return the input stream for decoding the specified Base64 encoded * byte stream */ public InputStream wrap(InputStream is) { the(is).shouldNotBeNull(); return new DecInputStream(is, isURL ? fromBase64URL : fromBase64, isMIME); }