/**
  * Constructs a <code>DataFlavor</code> that represents a <code>MimeType</code>.
  *
  * <p>The returned <code>DataFlavor</code> will have the following characteristics:
  *
  * <p>If the <code>mimeType</code> is "application/x-java-serialized-object;
  * class=&lt;representation class&gt;", the result is the same as calling <code>
  * new DataFlavor(Class:forName(&lt;representation class&gt;)</code>.
  *
  * <p>Otherwise:
  *
  * <pre>
  *     representationClass = InputStream
  *     mimeType            = mimeType
  * </pre>
  *
  * @param mimeType the string used to identify the MIME type for this flavor; if the the <code>
  *     mimeType</code> does not specify a "class=" parameter, or if the class is not successfully
  *     loaded, then an <code>IllegalArgumentException</code> is thrown
  * @param humanPresentableName the human-readable string used to identify this flavor; if this
  *     parameter is <code>null</code> then the value of the the MIME Content Type is used
  * @exception IllegalArgumentException if <code>mimeType</code> is invalid or if the class is not
  *     successfully loaded
  * @exception NullPointerException if <code>mimeType</code> is null
  */
 public DataFlavor(String mimeType, String humanPresentableName) {
   super();
   if (mimeType == null) {
     throw new NullPointerException("mimeType");
   }
   try {
     initialize(mimeType, humanPresentableName, this.getClass().getClassLoader());
   } catch (MimeTypeParseException mtpe) {
     throw new IllegalArgumentException("failed to parse:" + mimeType);
   } catch (ClassNotFoundException cnfe) {
     throw new IllegalArgumentException("can't find specified class: " + cnfe.getMessage());
   }
 }
Exemple #2
0
  // Exchange chunkId, devId, and ownedChunkArray
  void xPayload(String chunkId) {
    Socket conn = null;
    try {

      // Get message
      Object[] rPayload = (Object[]) in.readObject();
      chunkOwnedClientArray = (String[]) rPayload[1];
      connTo = (String) rPayload[0];
      chunkOwnedClientList = Arrays.asList(chunkOwnedClientArray);

      // Send Message
      Object[] payload = {chunkId, devId, chunkOwnedArray, filename};

      out.writeObject(payload);
      out.flush();
      System.out.println("chunkId being sent: " + chunkId + ", connected to: " + connTo);

    } catch (IOException ioException) {
      ioException.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }