@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { return memoryResourceReference.getContentType(); }
@Override public IResourceReference create(final byte[] buffer, final String mimeType, final String encoding) { if (buffer == null) { throw new IllegalArgumentException(); } return new MemoryResourceReference(buffer, mimeType, encoding); }
@Override public Long visitMemoryResource(final MemoryResourceReference memoryResourceReference) { return Long.valueOf(memoryResourceReference.getBuffer().length); }
@Override public InputStream visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws IOException { final String contentType = memoryResourceReference.getContentType(); if (!contentTypeAcceptor.accept(contentType)) { throw new IOException("Unexcepted mime type '" + contentType + "'"); //$NON-NLS-1$//$NON-NLS-2$ } return new ByteArrayInputStream(memoryResourceReference.getBuffer()); }
@Override public IConnectionDescription visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { return new MemoryConnectionDescription( memoryResourceReference, memoryResourceReference.getContentType(), memoryResourceReference.getTimeStamp()); }
@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { return memoryResourceReference.toString(); }
@Override public InputStream visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws IOException { final String contentType = memoryResourceReference.getContentType(); if (!contentTypeAcceptor.accept(contentType)) { throw new IOException("Unexcepted mime type '" + contentType + "'"); //$NON-NLS-1$//$NON-NLS-2$ } return new ByteArrayInputStream(memoryResourceReference.getBuffer()); }
@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { return memoryResourceReference.toString(); }
@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { return memoryResourceReference.getContentType(); }
@Override public URL visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws MalformedURLException { return new URL(memoryResourceReference.toString()); }
@Override public IResourceReference create(final byte[] buffer, final String mimeType, final String encoding) { if (buffer == null) { throw new IllegalArgumentException(); } return new MemoryResourceReference(buffer, mimeType, encoding); }
@Override public Long visitMemoryResource(final MemoryResourceReference memoryResourceReference) { return Long.valueOf(memoryResourceReference.getBuffer().length); }
@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { try { final String mimeType = memoryResourceReference.getContentType(); if (mimeType == null) { return null; } return new MimeType(mimeType).getSubType(); } catch (final MimeTypeParseException exception) { return null; } }
@Override public URI visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws URISyntaxException { return new URI(memoryResourceReference.toString()); }
final String data = matcher.group(7); if ("base64".equals(code)) { return new MemoryResourceReference(Base64.getDecoder().decode(data), mimeType, encoding); return new MemoryResourceReference(URLDecoder.decode(data, encoding).getBytes(encoding), mimeType, encoding);
@Override public String visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws RuntimeException { try { final String mimeType = memoryResourceReference.getContentType(); if (mimeType == null) { return null; } return new MimeType(mimeType).getSubType(); } catch (final MimeTypeParseException exception) { return null; } }
@Override public URL visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws MalformedURLException { return new URL(memoryResourceReference.toString()); }
final String data = matcher.group(7); if ("base64".equals(code)) { return new MemoryResourceReference(Base64.getDecoder().decode(data), mimeType, encoding); return new MemoryResourceReference(URLDecoder.decode(data, encoding).getBytes(encoding), mimeType, encoding);
@Override public URI visitMemoryResource(final MemoryResourceReference memoryResourceReference) throws URISyntaxException { return new URI(memoryResourceReference.toString()); }