public class Base64decoderStream
extends java.io.InputStream
Image createImage(String img64) {
ByteArrayStream bas = new ByteArrayStream(img64.getBytes()); // get a Stream to read the String
InputStream stringInput = bas.asInputStream(); // use ByteArrayStream as a java.io.InputStream compliant object
Base64decoderStream decoder = new Base64decoderStream(stringInput); // now we can read the original bytes
Stream imgSource = Stream.asStream(decoder); // use Base64decoderStream as a totalcross.io.Stream compliant object
return new Image(imgSource); // passing the stream directly to the image for the sake of memory
}
totalcross.io.Stream#asInputStream()},
totalcross.io.Stream#asStream(java.io.InputStream)}| Constructor and Description |
|---|
Base64decoderStream(java.io.InputStream base64encodedStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long n)
Unable to skip.
|
public Base64decoderStream(java.io.InputStream base64encodedStream)
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
IOExceptionskip in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException