Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 49 lines 1.5 kB view raw
1package net.minecraft.server; 2 3import java.io.*; 4import java.util.zip.GZIPInputStream; 5import java.util.zip.GZIPOutputStream; 6 7public class CompressedStreamTools { 8 9 public CompressedStreamTools() { 10 } 11 12 public static NBTTagCompound a(InputStream inputstream) throws IOException { 13 DataInputStream datainputstream = new DataInputStream(new GZIPInputStream(inputstream)); 14 15 NBTTagCompound nbttagcompound; 16 17 try { 18 nbttagcompound = a((DataInput) datainputstream); 19 } finally { 20 datainputstream.close(); 21 } 22 23 return nbttagcompound; 24 } 25 26 public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException { 27 DataOutputStream dataoutputstream = new DataOutputStream(new GZIPOutputStream(outputstream)); 28 29 try { 30 a(nbttagcompound, (DataOutput) dataoutputstream); 31 } finally { 32 dataoutputstream.close(); 33 } 34 } 35 36 public static NBTTagCompound a(DataInput datainput) throws IOException { 37 NBTBase nbtbase = NBTBase.b(datainput); 38 39 if (nbtbase instanceof NBTTagCompound) { 40 return (NBTTagCompound) nbtbase; 41 } else { 42 throw new IOException("Root tag must be a named compound tag"); 43 } 44 } 45 46 public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { 47 NBTBase.a(nbttagcompound, dataoutput); 48 } 49}