Class GcsSession
- java.lang.Object
-
- com.google.cloud.spring.storage.integration.GcsSession
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.springframework.integration.file.remote.session.Session<BlobInfo>
public class GcsSession extends Object implements org.springframework.integration.file.remote.session.Session<BlobInfo>
A session implementation for Google Cloud Storage.
-
-
Constructor Summary
Constructors Constructor Description GcsSession(Storage gcs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(InputStream inputStream, String destination)voidclose()booleanexists(String path)booleanfinalizeRaw()ObjectgetClientInstance()StringgetHostPort()booleanisOpen()BlobInfo[]list(String bucket)Only supports listing buckets, not folders.String[]listNames(String path)booleanmkdir(String directory)voidread(String source, OutputStream outputStream)InputStreamreadRaw(String source)booleanremove(String path)voidrename(String pathFrom, String pathTo)booleanrmdir(String directory)voidwrite(InputStream inputStream, String destination)
-
-
-
Constructor Detail
-
GcsSession
public GcsSession(Storage gcs)
-
-
Method Detail
-
remove
public boolean remove(String path) throws IOException
- Specified by:
removein interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
list
public BlobInfo[] list(String bucket) throws IOException
Only supports listing buckets, not folders.- Specified by:
listin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Parameters:
bucket- The name of the bucket.- Returns:
- The BlobInfo of all objects in the bucket.
- Throws:
IOException- Thrown if there an issue communicating with GCS.
-
read
public void read(String source, OutputStream outputStream) throws IOException
- Specified by:
readin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
write
public void write(InputStream inputStream, String destination) throws IOException
- Specified by:
writein interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
append
public void append(InputStream inputStream, String destination) throws IOException
- Specified by:
appendin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
mkdir
public boolean mkdir(String directory) throws IOException
- Specified by:
mkdirin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
rmdir
public boolean rmdir(String directory) throws IOException
- Specified by:
rmdirin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
rename
public void rename(String pathFrom, String pathTo) throws IOException
- Specified by:
renamein interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>
-
exists
public boolean exists(String path) throws IOException
- Specified by:
existsin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
listNames
public String[] listNames(String path) throws IOException
- Specified by:
listNamesin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
readRaw
public InputStream readRaw(String source) throws IOException
- Specified by:
readRawin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
finalizeRaw
public boolean finalizeRaw() throws IOException- Specified by:
finalizeRawin interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>- Throws:
IOException
-
getClientInstance
public Object getClientInstance()
- Specified by:
getClientInstancein interfaceorg.springframework.integration.file.remote.session.Session<BlobInfo>
-
-