001/* 002 * Copyright 2015-2024 the original author or authors 003 * 004 * This software is licensed under the Apache License, Version 2.0, 005 * the GNU Lesser General Public License version 2 or later ("LGPL") 006 * and the WTFPL. 007 * You may choose either license to govern your use of this software only 008 * upon the condition that you accept all of the terms of either 009 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL. 010 */ 011package org.minidns.record; 012 013import java.io.DataInputStream; 014import java.io.DataOutputStream; 015import java.io.IOException; 016 017import org.minidns.record.Record.TYPE; 018 019public final class UNKNOWN extends Data { 020 021 private final TYPE type; 022 private final byte[] data; 023 024 private UNKNOWN(DataInputStream dis, int payloadLength, TYPE type) throws IOException { 025 this.type = type; 026 this.data = new byte[payloadLength]; 027 dis.readFully(data); 028 } 029 030 @Override 031 public TYPE getType() { 032 return type; 033 } 034 035 @Override 036 public void serialize(DataOutputStream dos) throws IOException { 037 dos.write(data); 038 } 039 040 public static UNKNOWN parse(DataInputStream dis, int payloadLength, TYPE type) 041 throws IOException { 042 return new UNKNOWN(dis, payloadLength, type); 043 } 044 045}