Java Code Examples for com.google.api.client.util.IOUtils#deserialize()
The following examples show how to use
com.google.api.client.util.IOUtils#deserialize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomDataStoreFactory.java From hop with Apache License 2.0 | 6 votes |
public final V get( String key ) throws IOException { if ( key == null ) { return null; } else { this.lock.lock(); V var2; try { var2 = IOUtils.deserialize( (byte[]) this.keyValueMap.get( key ) ); } finally { this.lock.unlock(); } return var2; } }
Example 2
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 6 votes |
FileDataStore(FileDataStoreFactory dataStore, File dataDirectory, String id) throws IOException { super(dataStore, id); this.dataFile = new File(dataDirectory, id); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataFile)) { throw new IOException("unable to use a symbolic link: " + dataFile); } // create new file (if necessary) if (dataFile.createNewFile()) { keyValueMap = Maps.newHashMap(); // save the credentials to create a new file save(); } else { // load credentials from existing file keyValueMap = IOUtils.deserialize(new FileInputStream(dataFile)); } }
Example 3
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 6 votes |
FileDataStore(FileDataStoreFactory dataStore, File dataDirectory, String id) throws IOException { super(dataStore, id); this.dataFile = new File(dataDirectory, id); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataFile)) { throw new IOException("unable to use a symbolic link: " + dataFile); } // create new file (if necessary) if (dataFile.createNewFile()) { keyValueMap = Maps.newHashMap(); // save the credentials to create a new file save(); } else { // load credentials from existing file keyValueMap = IOUtils.deserialize(new FileInputStream(dataFile)); } }
Example 4
Source File: CustomDataStoreFactory.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public final V get( String key ) throws IOException { if ( key == null ) { return null; } else { this.lock.lock(); V var2; try { var2 = IOUtils.deserialize( (byte[]) this.keyValueMap.get( key ) ); } finally { this.lock.unlock(); } return var2; } }
Example 5
Source File: CustomDataStoreFactory.java From hop with Apache License 2.0 | 5 votes |
CustomDataStore( CustomDataStoreFactory dataStore, File dataDirectory, String id ) throws IOException { super( dataStore, id ); this.dataDirectory = dataDirectory; this.dataFile = new File( this.dataDirectory, getId() ); if ( IOUtils.isSymbolicLink( this.dataFile ) ) { throw new IOException( "unable to use a symbolic link: " + this.dataFile ); } this.keyValueMap = Maps.newHashMap(); if ( this.dataFile.exists() ) { this.keyValueMap = IOUtils.deserialize( new FileInputStream( this.dataFile ) ); } }
Example 6
Source File: AbstractMemoryDataStore.java From google-http-java-client with Apache License 2.0 | 5 votes |
public final V get(String key) throws IOException { if (key == null) { return null; } lock.lock(); try { return IOUtils.deserialize(keyValueMap.get(key)); } finally { lock.unlock(); } }
Example 7
Source File: CustomDataStoreFactory.java From pentaho-kettle with Apache License 2.0 | 5 votes |
CustomDataStore( CustomDataStoreFactory dataStore, File dataDirectory, String id ) throws IOException { super( dataStore, id ); this.dataDirectory = dataDirectory; this.dataFile = new File( this.dataDirectory, getId() ); if ( IOUtils.isSymbolicLink( this.dataFile ) ) { throw new IOException( "unable to use a symbolic link: " + this.dataFile ); } this.keyValueMap = Maps.newHashMap(); if ( this.dataFile.exists() ) { this.keyValueMap = (HashMap) IOUtils.deserialize( new FileInputStream( this.dataFile ) ); } }
Example 8
Source File: AppEngineDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 4 votes |
/** Deserializes the specified object from a Blob using an {@link ObjectInputStream}. */ private V deserialize(Entity entity) throws IOException { Blob blob = (Blob) entity.getProperty(FIELD_VALUE); return IOUtils.deserialize(blob.getBytes()); }