List of usage examples for java.io ObjectOutput writeObject
public void writeObject(Object obj) throws IOException;
From source file:org.fosstrak.epcis.repository.query.QueryOperationsBackendSQL.java
/** * {@inheritDoc}//ww w . ja va 2 s. c om */ public void storeSupscriptions(final QueryOperationsSession session, QueryParams queryParams, String dest, String subscrId, SubscriptionControls controls, String trigger, QuerySubscriptionScheduled newSubscription, String queryName, Schedule schedule) throws SQLException, ImplementationExceptionResponse { String insert = "INSERT INTO subscription (subscriptionid, " + "params, dest, sched, trigg, initialrecordingtime, " + "exportifempty, queryname, lastexecuted) VALUES " + "((?), (?), (?), (?), (?), (?), (?), (?), (?))"; PreparedStatement stmt = session.getConnection().prepareStatement(insert); LOG.debug("QUERY: " + insert); try { stmt.setString(1, subscrId); LOG.debug(" query param 1: " + subscrId); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(outStream); out.writeObject(queryParams); ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray()); stmt.setBinaryStream(2, inStream, inStream.available()); LOG.debug(" query param 2: [" + inStream.available() + " bytes]"); stmt.setString(3, dest.toString()); LOG.debug(" query param 3: " + dest); outStream = new ByteArrayOutputStream(); out = new ObjectOutputStream(outStream); out.writeObject(schedule); inStream = new ByteArrayInputStream(outStream.toByteArray()); stmt.setBinaryStream(4, inStream, inStream.available()); LOG.debug(" query param 4: [" + inStream.available() + " bytes]"); stmt.setString(5, trigger); LOG.debug(" query param 5: " + trigger); Calendar cal = newSubscription.getInitialRecordTime(); Timestamp ts = new Timestamp(cal.getTimeInMillis()); String time = ts.toString(); stmt.setString(6, time); LOG.debug(" query param 6: " + time); stmt.setBoolean(7, controls.isReportIfEmpty()); LOG.debug(" query param 7: " + controls.isReportIfEmpty()); stmt.setString(8, queryName); LOG.debug(" query param 8: " + queryName); stmt.setString(9, time); LOG.debug(" query param 9: " + time); stmt.executeUpdate(); session.commit(); } catch (IOException e) { String msg = "Unable to store the subscription to the database: " + e.getMessage(); LOG.error(msg); ImplementationException iex = new ImplementationException(); iex.setReason(msg); iex.setSeverity(ImplementationExceptionSeverity.ERROR); throw new ImplementationExceptionResponse(msg, iex, e); } }
From source file:gnu.trove.map.custom_hash.TObjectByteCustomHashMap.java
public void writeExternal(ObjectOutput out) throws IOException { // VERSION/* w w w. j a v a2 s.c o m*/ out.writeByte(0); // SUPER super.writeExternal(out); // STRATEGY out.writeObject(strategy); // NO_ENTRY_VALUE out.writeByte(no_entry_value); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _set.length; i-- > 0;) { if (_set[i] != REMOVED && _set[i] != FREE) { out.writeObject(_set[i]); out.writeByte(_values[i]); } } }
From source file:gnu.trove.map.custom_hash.TObjectCharCustomHashMap.java
public void writeExternal(ObjectOutput out) throws IOException { // VERSION/*from ww w . jav a 2 s. com*/ out.writeByte(0); // SUPER super.writeExternal(out); // STRATEGY out.writeObject(strategy); // NO_ENTRY_VALUE out.writeChar(no_entry_value); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _set.length; i-- > 0;) { if (_set[i] != REMOVED && _set[i] != FREE) { out.writeObject(_set[i]); out.writeChar(_values[i]); } } }
From source file:gnu.trove.map.custom_hash.TObjectDoubleCustomHashMap.java
public void writeExternal(ObjectOutput out) throws IOException { // VERSION// w w w . ja v a 2 s.c o m out.writeByte(0); // SUPER super.writeExternal(out); // STRATEGY out.writeObject(strategy); // NO_ENTRY_VALUE out.writeDouble(no_entry_value); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _set.length; i-- > 0;) { if (_set[i] != REMOVED && _set[i] != FREE) { out.writeObject(_set[i]); out.writeDouble(_values[i]); } } }
From source file:gnu.trove.map.custom_hash.TObjectFloatCustomHashMap.java
public void writeExternal(ObjectOutput out) throws IOException { // VERSION// w w w .java 2 s . c om out.writeByte(0); // SUPER super.writeExternal(out); // STRATEGY out.writeObject(strategy); // NO_ENTRY_VALUE out.writeFloat(no_entry_value); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _set.length; i-- > 0;) { if (_set[i] != REMOVED && _set[i] != FREE) { out.writeObject(_set[i]); out.writeFloat(_values[i]); } } }
From source file:edu.dfci.cccb.mev.domain.Heatmap.java
public void toStream(final Object rowSeparator, final Object columnSeparator, final ObjectOutput out) throws IOException { data.walkInRowOrder(new RealMatrixPreservingVisitor() { @Override//w w w .j a va 2 s.c o m @SneakyThrows(IOException.class) public void visit(int row, int column, double value) { if (column == 0 && row != 0) out.writeObject(columnSeparator); else if (row != 0) out.writeObject(rowSeparator); out.writeObject(value); } @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { } @Override public double end() { return 0; } }); }
From source file:org.openfaces.component.table.impl.TableDataModel.java
public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(groupingRules); out.writeObject(sortingRules);//from w w w .j a v a 2 s .co m ValueBindings.writeValueExpression(out, rowKeyExpression); ValueBindings.writeValueExpression(out, rowDataByKeyExpression); out.writeInt(pageSize); out.writeInt(pageIndex); out.writeObject(extractedRowKeys); }
From source file:com.inmobi.grill.server.query.QueryExecutionServiceImpl.java
@Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); // persist all drivers synchronized (drivers) { out.writeInt(drivers.size());/* w ww . ja v a2 s .c o m*/ for (GrillDriver driver : drivers) { out.writeUTF(driver.getClass().getName()); driver.writeExternal(out); } } // persist allQueries synchronized (allQueries) { out.writeInt(allQueries.size()); for (QueryContext ctx : allQueries.values()) { out.writeObject(ctx); boolean isDriverAvailable = (ctx.getSelectedDriver() != null); out.writeBoolean(isDriverAvailable); if (isDriverAvailable) { out.writeUTF(ctx.getSelectedDriver().getClass().getName()); } } } LOG.info("Persisted " + allQueries.size() + " queries"); }
From source file:org.apache.lens.driver.hive.HiveDriver.java
@Override public void writeExternal(ObjectOutput out) throws IOException { // Write the query handle to hive handle map to output synchronized (hiveHandles) { out.writeInt(hiveHandles.size()); for (Map.Entry<QueryHandle, OperationHandle> entry : hiveHandles.entrySet()) { out.writeObject(entry.getKey()); out.writeObject(entry.getValue().toTOperationHandle()); log.debug("Hive driver {} persisted {}:{}", getFullyQualifiedName(), entry.getKey(), entry.getValue());/*from w w w .j a v a 2s . c o m*/ } log.info("Hive driver {} persisted {} queries ", getFullyQualifiedName(), hiveHandles.size()); out.writeInt(lensToHiveSession.size()); for (Map.Entry<String, SessionHandle> entry : lensToHiveSession.entrySet()) { out.writeUTF(entry.getKey()); out.writeObject(entry.getValue().toTSessionHandle()); } log.info("Hive driver {} persisted {} sessions", getFullyQualifiedName(), lensToHiveSession.size()); out.writeInt(opHandleToSession.size()); for (Map.Entry<OperationHandle, SessionHandle> entry : opHandleToSession.entrySet()) { out.writeObject(entry.getKey().toTOperationHandle()); out.writeObject(entry.getValue().toTSessionHandle()); } log.info("Hive driver {} persisted {} operation handles", getFullyQualifiedName(), opHandleToSession.size()); out.writeInt(orphanedHiveSessions.size()); for (SessionHandle sessionHandle : orphanedHiveSessions) { out.writeObject(sessionHandle.toTSessionHandle()); } log.info("Hive driver {} persisted {} orphaned sessions", getFullyQualifiedName(), orphanedHiveSessions.size()); } }
From source file:org.apache.tapestry.engine.AbstractEngine.java
/** * Writes the following properties:/* w ww. j a v a2 s.c o m*/ * * <ul> * <li>locale name ({@link Locale#toString()}) * <li>visit * </ul> * **/ public void writeExternal(ObjectOutput out) throws IOException { out.writeUTF(_locale.toString()); out.writeObject(_visit); }