com.khannedy.sajikeun.servlet.Asset.java Source code

Java tutorial

Introduction

Here is the source code for com.khannedy.sajikeun.servlet.Asset.java

Source

/*
 * Copyright 2014 Eko Khannedy
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.khannedy.sajikeun.servlet;

import com.google.common.hash.Hashing;

/**
 * @author Eko Khannedy
 */
public class Asset {

    private final byte[] resource;

    private final String eTag;

    private final long lastModified;

    public Asset(byte[] resource, long lastModified) {
        this.resource = resource;
        this.eTag = '"' + Hashing.murmur3_128().hashBytes(resource).toString() + '"';
        this.lastModified = lastModified;
    }

    public byte[] getResource() {
        return resource;
    }

    public String getETag() {
        return eTag;
    }

    public long getLastModified() {
        return lastModified;
    }
}