ContentResolver openOutputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ContentResolver openOutputStream method.

This code example shows how to use the following methods:openInputStream, openOutputStream
     * {@inheritDoc} 
     */ 
    @Override 
    public void connect() throws IOException { 
        if (getDoInput()) {
            InputStream in = mResolver.openInputStream(mUri);
            mInputStream = new ContentURLConnectionInputStream(in);
        } 
        if (getDoOutput()) {
            OutputStream out = mResolver.openOutputStream(mUri, "rwt");
            mOutputStream = new ContentURLConnectionOutputStream(out);
        } 
        mConnected = true;
    } 
 
    @Override 
    public InputStream getInputStream() throws IOException {
        if (mInputStreamClosed) {
            throw new IllegalStateException("Closed");
        } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:delete, openOutputStream, query, update
        @Override 
        protected Void execute() throws InterruptedException, ExecutionException {
            boolean complete = false;
            try { 
                String[] projection = new String[] { ImageColumns._ID, ImageColumns.MINI_THUMB_MAGIC };
                Cursor c = mCr.query(mUri, projection, null, null, null);
                try { 
                    c.moveToPosition(0);
                } finally { 
                    c.close();
                } 
                ContentValues values = new ContentValues();
                values.put(ImageColumns.MINI_THUMB_MAGIC, 0);
                mCr.update(mUri, values, null, null);
                OutputStream outputStream = null;
                try { 
                    outputStream = mCr.openOutputStream(mUri);
                    if (outputStream != null) {
                        outputStream.write(mJpegData);
                    } 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:openOutputStream
    } 
 
    public static Uri insert(Context context, DrmWrapper drmObj)
            throws IOException { 
        ContentResolver cr = context.getContentResolver();
        Uri uri = SqliteWrapper.insert(context, cr, DRM_TEMP_URI,
                                       new ContentValues(0));
        OutputStream os = null;
        try { 
            os = cr.openOutputStream(uri);
            byte[] data = drmObj.getDecryptedData();
            if (data != null) {
                os.write(data);
            } 
            return uri;
        } finally { 
            if (os != null) {
                try { 
                    os.close();
                } catch (IOException e) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:openOutputStream
    } 
 
    public static Uri insert(Context context, DrmWrapper drmObj)
            throws IOException { 
        ContentResolver cr = context.getContentResolver();
        Uri uri = SqliteWrapper.insert(context, cr, DRM_TEMP_URI,
                                       new ContentValues(0));
        OutputStream os = null;
        try { 
            os = cr.openOutputStream(uri);
            byte[] data = drmObj.getDecryptedData();
            if (data != null) {
                os.write(data);
            } 
            return uri;
        } finally { 
            if (os != null) {
                try { 
                    os.close();
                } catch (IOException e) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:openOutputStream
 
 
    @Override 
    public void put(String key, byte[] data) throws IOException {
	Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
	OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
	try { 
	    os.write(data);
	} finally { 
	    os.close();
	} 
    } 
 
    @Override 
    public void put(String key, InputStream in) throws IOException {
	Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
	OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
	try { 
	    byte[] data = new byte[1024];
	    int nbread;
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related ContentResolver openOutputStream Questions & Answers:

openOutputStream Method Overview
Synonym for openOutputStream(uri, "w").
See Code Examples for other Android ContentResolver Methods: