@@ -65,10 +65,10 @@ public class TiBlob extends KrollProxy
65
65
public static final int TYPE_STRING = 3 ;
66
66
67
67
/**
68
- * Represents a Blob that contains stream data.
68
+ * Represents a Blob that contains stream data that needs to be converted to base64 .
69
69
* @module.api
70
70
*/
71
- public static final int TYPE_STREAM = 4 ;
71
+ public static final int TYPE_STREAM_BASE64 = 4 ;
72
72
73
73
private int type ;
74
74
private Object data ;
@@ -110,13 +110,13 @@ public static TiBlob blobFromFile(TiBaseFile file)
110
110
}
111
111
112
112
/**
113
- * Creates a blob from a stream.
113
+ * Creates a blob from a stream to convert to base64 .
114
114
* @param stream the stream used to create blob.
115
115
* @return new instane of TiBlob.
116
116
*/
117
- public static TiBlob blobFromStream (InputStream stream , String mimeType )
117
+ public static TiBlob blobFromStreamBase64 (InputStream stream , String mimeType )
118
118
{
119
- return new TiBlob (TYPE_STREAM , stream , mimeType );
119
+ return new TiBlob (TYPE_STREAM_BASE64 , stream , mimeType );
120
120
}
121
121
122
122
/**
@@ -285,7 +285,7 @@ public byte[] getBytes()
285
285
}
286
286
}
287
287
break ;
288
- case TYPE_STREAM :
288
+ case TYPE_STREAM_BASE64 :
289
289
InputStream inStream = (InputStream )data ;
290
290
if (inStream != null ) {
291
291
try {
@@ -320,8 +320,8 @@ public int getLength()
320
320
case TYPE_DATA :
321
321
case TYPE_IMAGE :
322
322
return ((byte [])data ).length ;
323
- case TYPE_STREAM :
324
- throw new IllegalStateException ("Not yet implemented. TYPE_STREAM " );
323
+ case TYPE_STREAM_BASE64 :
324
+ throw new IllegalStateException ("Not yet implemented. TYPE_STREAM_BASE64 " );
325
325
default :
326
326
// this is probably overly expensive.. is there a better way?
327
327
return getBytes ().length ;
@@ -342,7 +342,7 @@ public InputStream getInputStream()
342
342
Log .e (TAG , e .getMessage (), e );
343
343
return null ;
344
344
}
345
- case TYPE_STREAM :
345
+ case TYPE_STREAM_BASE64 :
346
346
return (InputStream )data ;
347
347
default :
348
348
return new ByteArrayInputStream (getBytes ());
@@ -373,8 +373,8 @@ public void append(TiBlob blob)
373
373
break ;
374
374
case TYPE_FILE :
375
375
throw new IllegalStateException ("Not yet implemented. TYPE_FILE" );
376
- case TYPE_STREAM :
377
- throw new IllegalStateException ("Not yet implemented. TYPE_STREAM " );
376
+ case TYPE_STREAM_BASE64 :
377
+ throw new IllegalStateException ("Not yet implemented. TYPE_STREAM_BASE64 " );
378
378
// break;
379
379
default :
380
380
throw new IllegalArgumentException ("Unknown Blob type id " + type );
@@ -405,8 +405,8 @@ public String getText()
405
405
Log .w (TAG , "Unable to convert to string." );
406
406
}
407
407
break ;
408
- case TYPE_STREAM :
409
- throw new IllegalStateException ("Not yet implemented. TYPE_STREAM " );
408
+ case TYPE_STREAM_BASE64 :
409
+ throw new IllegalStateException ("Not yet implemented. TYPE_STREAM_BASE64 " );
410
410
}
411
411
412
412
return result ;
0 commit comments