use of java.io.ObjectOutput in project hibernate-orm by hibernate.
the class JpaDescriptorParser method saveTimeStampCache.
private void saveTimeStampCache(FileTimeStampChecker fileStampCheck) {
try {
File file = getSerializationTmpFile();
ObjectOutput out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(fileStampCheck);
out.close();
context.logMessage(Diagnostic.Kind.OTHER, "Serialized " + fileStampCheck + " into " + file.getAbsolutePath());
} catch (IOException e) {
// ignore - if the serialization failed we just have to keep parsing the xml
context.logMessage(Diagnostic.Kind.OTHER, "Error serializing " + fileStampCheck);
}
}
use of java.io.ObjectOutput in project lucene-solr by apache.
the class TestRegExp method testSerializeTooManyStatesToDeterminizeExc.
// LUCENE-6713
public void testSerializeTooManyStatesToDeterminizeExc() throws Exception {
// LUCENE-6046
String source = "[ac]*a[ac]{50,200}";
TooComplexToDeterminizeException expected = expectThrows(TooComplexToDeterminizeException.class, () -> {
new RegExp(source).toAutomaton();
});
assertTrue(expected.getMessage().contains(source));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bos);
out.writeObject(expected);
byte[] bytes = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInput in = new ObjectInputStream(bis);
TooComplexToDeterminizeException e2 = (TooComplexToDeterminizeException) in.readObject();
assertNotNull(e2.getMessage());
}
use of java.io.ObjectOutput in project jackrabbit-oak by apache.
the class AbstractDataStoreCacheTest method serializeMap.
static void serializeMap(Map<String, Long> pendingupload, File file) throws IOException {
OutputStream fos = new FileOutputStream(file);
OutputStream buffer = new BufferedOutputStream(fos);
ObjectOutput output = new ObjectOutputStream(buffer);
try {
output.writeObject(pendingupload);
output.flush();
} finally {
output.close();
IOUtils.closeQuietly(buffer);
}
}
use of java.io.ObjectOutput in project sessdb by ppdai.
the class SampleValue method toBytes.
public byte[] toBytes() throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
try {
out = new ObjectOutputStream(bos);
out.writeObject(this);
byte[] yourBytes = bos.toByteArray();
return yourBytes;
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
// ignore close exception
}
try {
bos.close();
} catch (IOException ex) {
// ignore close exception
}
}
}
use of java.io.ObjectOutput in project quasar by puniverse.
the class JDKSerializer method write.
@Override
public void write(OutputStream os, Object object) throws IOException {
final ObjectOutput oo = toObjectOutput(os);
oo.writeObject(object);
}
Aggregations