use of java.io.ObjectInputStream in project tdi-studio-se by Talend.
the class JetSkeletonManager method deserializeAlreadyChecked.
@SuppressWarnings("unchecked")
private void deserializeAlreadyChecked() throws Exception {
alreadyCheckedSkeleton = new HashMap<String, Long>();
File file = getSerializationFilePath();
if (!file.exists()) {
return;
}
BufferedInputStream bufferedInputStream = null;
try {
bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
ObjectInputStream objectIn = new ObjectInputStream(bufferedInputStream);
alreadyCheckedSkeleton = (Map<String, Long>) objectIn.readObject();
} catch (Exception e) {
throw e;
} finally {
try {
bufferedInputStream.close();
} catch (Exception e) {
// ignore me even if i'm null
}
}
}
use of java.io.ObjectInputStream in project android_frameworks_base by ResurrectionRemix.
the class SerializedFrame method deserializeObjectValue.
private final Object deserializeObjectValue() {
try {
InputStream inputStream = mByteOutputStream.getInputStream();
ObjectInputStream objectStream = new ObjectInputStream(inputStream);
return objectStream.readObject();
} catch (IOException e) {
throw new RuntimeException("Could not deserialize object in " + this + "!", e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Unable to deserialize object of unknown class in " + this + "!", e);
}
}
use of java.io.ObjectInputStream in project opennms by OpenNMS.
the class JCEKSSecureCredentialsVault method fromBase64EncodedByteArray.
private static <T extends Serializable> T fromBase64EncodedByteArray(byte[] bytes) throws IOException, ClassNotFoundException {
byte[] decodedBytes = Base64.decodeBase64(bytes);
ByteArrayInputStream bais = new ByteArrayInputStream(decodedBytes);
ObjectInputStream in = new ObjectInputStream(bais);
@SuppressWarnings("unchecked") T o = (T) in.readObject();
in.close();
return o;
}
use of java.io.ObjectInputStream in project OpenAM by OpenRock.
the class SessionService method decrypt.
/**
* This method is used to decrypt the InternalSession object, after
* obtaining from HttpSession.
*
* @param strEncrypted Object to be decrypted
*/
private InternalSession decrypt(String strEncrypted) {
if (strEncrypted == null)
return null;
String strDecrypted;
byte[] byteDecrypted = null;
ByteArrayInputStream byteIn;
ObjectInputStream objInStream;
Object tempObject = null;
try {
// decrypt string
strDecrypted = AccessController.doPrivileged(new DecodeAction(strEncrypted, Crypt.getHardcodedKeyEncryptor()));
// convert string to byte
byteDecrypted = Base64.decode(strDecrypted);
// convert byte to object using streams
byteIn = new ByteArrayInputStream(byteDecrypted);
objInStream = new ObjectInputStream(byteIn);
tempObject = objInStream.readObject();
} catch (Exception e) {
sessionDebug.message("Error in decrypting the Internal Session object" + e.getMessage());
return null;
}
if (tempObject == null) {
return null;
}
return (InternalSession) tempObject;
}
use of java.io.ObjectInputStream in project screenbird by adamhub.
the class FileUtil method readObjectDataFromFile.
public static Object readObjectDataFromFile(String name) {
Object obj = new Object();
try {
FileInputStream fin = new FileInputStream(Settings.SCREEN_CAPTURE_DIR + name);
ObjectInputStream ois = new ObjectInputStream(fin);
obj = ois.readObject();
ois.close();
} catch (ClassNotFoundException e) {
log(e);
} catch (IOException e) {
log(e);
}
return obj;
}
Aggregations