![JAR search and dependency download from the Maven repository](/logo.png)
org.fit.net.DataURLConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstyleparser Show documentation
Show all versions of jstyleparser Show documentation
jStyleParser is a CSS parser written in Java. It has its own application interface that is designed to allow an efficient CSS processing in Java and mapping the values to the Java data types. It parses CSS 2.1 style sheets into structures that can be efficiently assigned to DOM elements. It is intended be the primary CSS parser for the CSSBox library. While handling errors, it is user agent conforming according to the CSS specification.
The newest version!
/**
* DataURLConnection.java
*/
package org.fit.net;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
/**
* The URL connection for the data: URI scheme.
* @author burgetr
*/
class DataURLConnection extends URLConnection
{
private String mime;
private String charset;
private byte[] data;
public DataURLConnection(URL url, String mime, String charset, byte[] data)
{
super(url);
this.mime = new String(mime);
this.charset = new String(charset);
this.data = data;
}
protected DataURLConnection(URL url)
{
super(url);
}
@Override
public void connect() throws IOException
{
}
@Override
public String getContentEncoding()
{
return charset;
}
@Override
public int getContentLength()
{
return data.length;
}
@Override
public String getContentType()
{
return mime;
}
@Override
public InputStream getInputStream() throws IOException
{
return new ByteArrayInputStream(data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy