protected void javaToNative(Object data, TransferData transferData) { if (! (data instanceof TypedSource[])) return; TypedSource[] sources = (TypedSource[]) data; /* * The serialization format is: * (int) number of elements * Then, the following for each element: * (int) type (see <code>IJavaElement</code>) * (String) source of the element */ try { ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(out); dataOut.writeInt(sources.length); for (int i = 0; i < sources.length; i++) { writeJavaElement(dataOut, sources[i]); } dataOut.close(); out.close(); super.javaToNative(out.toByteArray(), transferData); } catch (IOException e) { //it's best to send nothing if there were problems } }
@Override protected void javaToNative(Object data, TransferData transferData) { if (! (data instanceof TypedSource[])) return; TypedSource[] sources = (TypedSource[]) data; /* * The serialization format is: * (int) number of elements * Then, the following for each element: * (int) type (see <code>IJavaElement</code>) * (String) source of the element */ try { ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(out); dataOut.writeInt(sources.length); for (int i = 0; i < sources.length; i++) { writeJavaElement(dataOut, sources[i]); } dataOut.close(); out.close(); super.javaToNative(out.toByteArray(), transferData); } catch (IOException e) { //it's best to send nothing if there were problems } }
@Override protected void javaToNative(Object data, TransferData transferData) { if (! (data instanceof TypedSource[])) return; TypedSource[] sources = (TypedSource[]) data; /* * The serialization format is: * (int) number of elements * Then, the following for each element: * (int) type (see <code>IJavaElement</code>) * (String) source of the element */ try { ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(out); dataOut.writeInt(sources.length); for (int i = 0; i < sources.length; i++) { writeJavaElement(dataOut, sources[i]); } dataOut.close(); out.close(); super.javaToNative(out.toByteArray(), transferData); } catch (IOException e) { //it's best to send nothing if there were problems } }