@SuppressWarnings("unchecked") private static<T> T doDeepCopy(T o) { try { HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(o, hdos); return (T)DataSerializer.readObject(new DataInputStream(hdos.getInputStream())); } catch (ClassNotFoundException ex) { throw new CopyException(LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()), ex); } catch (IOException ex) { throw new CopyException(LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()), ex); } } }
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT); DataSerializer.writeObject(o, hdos); copy = (T)DataSerializer.readObject(new DataInputStream(hdos.getInputStream())); return copy; } catch (ClassNotFoundException ex) {
public GraphSet readGraphs(Filter filter, boolean areGemfireLogs) throws IOException { GraphSet graphs = new GraphSet(); if(areGemfireLogs) { //TODO - probably don't need to go all the way //to a binary format here, but this is quick and easy. HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); GemfireLogConverter.convertFiles(out, files); InputStreamReader reader = new InputStreamReader(out.getInputStream()); reader.addToGraphs(graphs, filter); } else { for(File file : files) { FileInputStream fis = new FileInputStream(file); InputStreamReader reader = new InputStreamReader(fis); reader.addToGraphs(graphs, filter); } } graphs.readingDone(); return graphs; } }
public GraphSet readGraphs(Filter filter, boolean areGemfireLogs) throws IOException { GraphSet graphs = new GraphSet(); if(areGemfireLogs) { //TODO - probably don't need to go all the way //to a binary format here, but this is quick and easy. HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); GemfireLogConverter.convertFiles(out, files); InputStreamReader reader = new InputStreamReader(out.getInputStream()); reader.addToGraphs(graphs, filter); } else { for(File file : files) { FileInputStream fis = new FileInputStream(file); InputStreamReader reader = new InputStreamReader(fis); reader.addToGraphs(graphs, filter); } } graphs.readingDone(); return graphs; } }
DataInputStream in = new DataInputStream(hdos.getInputStream()); SelectResults setCopy = (SelectResults)DataSerializer.readObject(in);