blob: 874e33b32ed68714d23abf6bc098e133fc9c6eff [file] [log] [blame]
/*
* Copyright (c) 2015 Eike Stepper (Berlin, Germany) and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.userstorage.tests;
import org.eclipse.userstorage.IBlob;
import org.eclipse.userstorage.IStorage;
import org.eclipse.userstorage.StorageFactory;
import org.eclipse.userstorage.internal.util.IOUtil;
import org.eclipse.userstorage.util.FileStorageCache;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* @author Eike Stepper
*/
public class Example
{
public static void main(String[] args) throws IOException
{
IStorage storage = StorageFactory.DEFAULT.create("pDKTqBfDuNxlAKydhEwxBZPxa4q", new FileStorageCache());
IBlob blob = storage.getBlob("test_blob");
blob.setContentsUTF("A short UTF-8 string value");
InputStream in = blob.getContents();
IOUtil.copy(in, new FileOutputStream("user.txt"));
IOUtil.close(in);
}
}