1 /* |
1 /* |
2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
1182 return mimeType.match(mtype); |
1182 return mimeType.match(mtype); |
1183 } |
1183 } |
1184 |
1184 |
1185 /** |
1185 /** |
1186 * Does the <code>DataFlavor</code> represent a serialized object? |
1186 * Does the <code>DataFlavor</code> represent a serialized object? |
|
1187 * @return whether or not a serialized object is represented |
1187 */ |
1188 */ |
1188 |
|
1189 public boolean isMimeTypeSerializedObject() { |
1189 public boolean isMimeTypeSerializedObject() { |
1190 return isMimeTypeEqual(javaSerializedObjectMimeType); |
1190 return isMimeTypeEqual(javaSerializedObjectMimeType); |
1191 } |
1191 } |
1192 |
1192 |
|
1193 /** |
|
1194 * Returns the default representation class. |
|
1195 * @return the default representation class |
|
1196 */ |
1193 public final Class<?> getDefaultRepresentationClass() { |
1197 public final Class<?> getDefaultRepresentationClass() { |
1194 return ioInputStreamClass; |
1198 return ioInputStreamClass; |
1195 } |
1199 } |
1196 |
1200 |
|
1201 /** |
|
1202 * Returns the name of the default representation class. |
|
1203 * @return the name of the default representation class |
|
1204 */ |
1197 public final String getDefaultRepresentationClassAsString() { |
1205 public final String getDefaultRepresentationClassAsString() { |
1198 return getDefaultRepresentationClass().getName(); |
1206 return getDefaultRepresentationClass().getName(); |
1199 } |
1207 } |
1200 |
1208 |
1201 /** |
1209 /** |
1202 * Does the <code>DataFlavor</code> represent a |
1210 * Does the <code>DataFlavor</code> represent a |
1203 * <code>java.io.InputStream</code>? |
1211 * <code>java.io.InputStream</code>? |
|
1212 * @return whether or not this {@code DataFlavor} represent a |
|
1213 * {@code java.io.InputStream} |
1204 */ |
1214 */ |
1205 |
|
1206 public boolean isRepresentationClassInputStream() { |
1215 public boolean isRepresentationClassInputStream() { |
1207 return ioInputStreamClass.isAssignableFrom(representationClass); |
1216 return ioInputStreamClass.isAssignableFrom(representationClass); |
1208 } |
1217 } |
1209 |
1218 |
1210 /** |
1219 /** |
1211 * Returns whether the representation class for this |
1220 * Returns whether the representation class for this |
1212 * <code>DataFlavor</code> is <code>java.io.Reader</code> or a subclass |
1221 * <code>DataFlavor</code> is <code>java.io.Reader</code> or a subclass |
1213 * thereof. |
1222 * thereof. |
|
1223 * @return whether or not the representation class for this |
|
1224 * {@code DataFlavor} is {@code java.io.Reader} or a subclass |
|
1225 * thereof |
1214 * |
1226 * |
1215 * @since 1.4 |
1227 * @since 1.4 |
1216 */ |
1228 */ |
1217 public boolean isRepresentationClassReader() { |
1229 public boolean isRepresentationClassReader() { |
1218 return java.io.Reader.class.isAssignableFrom(representationClass); |
1230 return java.io.Reader.class.isAssignableFrom(representationClass); |
1220 |
1232 |
1221 /** |
1233 /** |
1222 * Returns whether the representation class for this |
1234 * Returns whether the representation class for this |
1223 * <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a |
1235 * <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a |
1224 * subclass thereof. |
1236 * subclass thereof. |
|
1237 * @return whether or not the representation class for this |
|
1238 * {@code DataFlavor} is {@code java.nio.CharBuffer} or a subclass |
|
1239 * thereof |
1225 * |
1240 * |
1226 * @since 1.4 |
1241 * @since 1.4 |
1227 */ |
1242 */ |
1228 public boolean isRepresentationClassCharBuffer() { |
1243 public boolean isRepresentationClassCharBuffer() { |
1229 return java.nio.CharBuffer.class.isAssignableFrom(representationClass); |
1244 return java.nio.CharBuffer.class.isAssignableFrom(representationClass); |
1231 |
1246 |
1232 /** |
1247 /** |
1233 * Returns whether the representation class for this |
1248 * Returns whether the representation class for this |
1234 * <code>DataFlavor</code> is <code>java.nio.ByteBuffer</code> or a |
1249 * <code>DataFlavor</code> is <code>java.nio.ByteBuffer</code> or a |
1235 * subclass thereof. |
1250 * subclass thereof. |
|
1251 * @return whether or not the representation class for this |
|
1252 * {@code DataFlavor} is {@code java.nio.ByteBuffer} or a subclass |
|
1253 * thereof |
1236 * |
1254 * |
1237 * @since 1.4 |
1255 * @since 1.4 |
1238 */ |
1256 */ |
1239 public boolean isRepresentationClassByteBuffer() { |
1257 public boolean isRepresentationClassByteBuffer() { |
1240 return java.nio.ByteBuffer.class.isAssignableFrom(representationClass); |
1258 return java.nio.ByteBuffer.class.isAssignableFrom(representationClass); |
1406 * This method is called for each parameter name/value pair and should |
1424 * This method is called for each parameter name/value pair and should |
1407 * return the normalized representation of the <code>parameterValue</code>. |
1425 * return the normalized representation of the <code>parameterValue</code>. |
1408 * |
1426 * |
1409 * This method is never invoked by this implementation from 1.1 onwards. |
1427 * This method is never invoked by this implementation from 1.1 onwards. |
1410 * |
1428 * |
|
1429 * @param parameterName the parameter name |
|
1430 * @param parameterValue the parameter value |
|
1431 * @return the parameter value |
1411 * @deprecated |
1432 * @deprecated |
1412 */ |
1433 */ |
1413 @Deprecated |
1434 @Deprecated |
1414 protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) { |
1435 protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) { |
1415 return parameterValue; |
1436 return parameterValue; |
1422 * parameter/value pairs in cases where none are present in the MIME |
1443 * parameter/value pairs in cases where none are present in the MIME |
1423 * type string passed in. |
1444 * type string passed in. |
1424 * |
1445 * |
1425 * This method is never invoked by this implementation from 1.1 onwards. |
1446 * This method is never invoked by this implementation from 1.1 onwards. |
1426 * |
1447 * |
|
1448 * @param mimeType the mime type |
|
1449 * @return the mime type |
1427 * @deprecated |
1450 * @deprecated |
1428 */ |
1451 */ |
1429 @Deprecated |
1452 @Deprecated |
1430 protected String normalizeMimeType(String mimeType) { |
1453 protected String normalizeMimeType(String mimeType) { |
1431 return mimeType; |
1454 return mimeType; |