use of java.io.ObjectOutputStream in project javatari by ppeccin.
the class RemoteTransmitter method connect.
private void connect(Socket toSocket) throws IOException {
socket = toSocket;
socket.setTcpNoDelay(true);
socketOutputStream = socket.getOutputStream();
outputStream = new ObjectOutputStream(socketOutputStream);
socketInputStream = socket.getInputStream();
inputStream = new ObjectInputStream(socketInputStream);
resetUpdatesPending();
console.clientConnected();
notifyConnectionStatusListeners();
}
use of java.io.ObjectOutputStream in project sessdb by ppdai.
the class AbstractSortedMapTable method persistBloomFilter.
public void persistBloomFilter() throws IOException {
ensureNotClosed();
File file = new File(this.bloomFilterFile);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
oos.writeObject(this.bloomFilter);
oos.flush();
} finally {
oos.close();
fos.close();
}
}
use of java.io.ObjectOutputStream in project camel by apache.
the class JdbcCamelCodec method encode.
private byte[] encode(Object object) throws IOException {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
ObjectOutputStream objectOut = new ObjectOutputStream(bytesOut);
objectOut.writeObject(object);
objectOut.close();
byte[] data = bytesOut.toByteArray();
return data;
}
use of java.io.ObjectOutputStream in project flink by apache.
the class JavaSerializer method write.
@SuppressWarnings("unchecked")
@Override
public void write(Kryo kryo, Output output, T o) {
try {
ObjectMap graphContext = kryo.getGraphContext();
ObjectOutputStream objectStream = (ObjectOutputStream) graphContext.get(this);
if (objectStream == null) {
objectStream = new ObjectOutputStream(output);
graphContext.put(this, objectStream);
}
objectStream.writeObject(o);
objectStream.flush();
} catch (Exception ex) {
throw new KryoException("Error during Java serialization.", ex);
}
}
use of java.io.ObjectOutputStream in project flink by apache.
the class DelimitedInputFormatTest method testSerialization.
@Test
public void testSerialization() throws Exception {
final byte[] DELIMITER = new byte[] { 1, 2, 3, 4 };
final int NUM_LINE_SAMPLES = 7;
final int LINE_LENGTH_LIMIT = 12345;
final int BUFFER_SIZE = 178;
DelimitedInputFormat<String> format = new MyTextInputFormat();
format.setDelimiter(DELIMITER);
format.setNumLineSamples(NUM_LINE_SAMPLES);
format.setLineLengthLimit(LINE_LENGTH_LIMIT);
format.setBufferSize(BUFFER_SIZE);
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(format);
oos.flush();
oos.close();
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
@SuppressWarnings("unchecked") DelimitedInputFormat<String> deserialized = (DelimitedInputFormat<String>) ois.readObject();
assertEquals(NUM_LINE_SAMPLES, deserialized.getNumLineSamples());
assertEquals(LINE_LENGTH_LIMIT, deserialized.getLineLengthLimit());
assertEquals(BUFFER_SIZE, deserialized.getBufferSize());
assertArrayEquals(DELIMITER, deserialized.getDelimiter());
}
Aggregations