private static void readSkipSlot(ByteBuf packet, int protocolVersion) { if ( (protocolVersion >= ProtocolConstants.MINECRAFT_1_13_2) ? packet.readBoolean() : packet.readShort() != -1 ) { if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13_2 ) { DefinedPacket.readVarInt( packet ); } packet.skipBytes( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? 1 : 3 ); // byte vs byte, short int position = packet.readerIndex(); if ( packet.readByte() != 0 ) { packet.readerIndex( position ); try { new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); } catch ( IOException ex ) { throw Throwables.propagate( ex ); } } } }
try new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); } catch ( IOException ex )
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
input = new NBTInputStream(new FileInputStream(argFile), compressed, order); } catch (IOException e) { System.err.println("Error opening NBT file: " + e);
input = new NBTInputStream(new FileInputStream(argFile), compressed, order); } catch (IOException e) { System.err.println("Error opening NBT file: " + e);
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
input = new NBTInputStream(new FileInputStream(argFile), compressed, order); } catch (IOException e) { System.err.println("Error opening NBT file: " + e);
ByteArrayInputStream in = new ByteArrayInputStream(data); InflaterInputStream iis = new InflaterInputStream(in); NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag();
ByteArrayInputStream in = new ByteArrayInputStream(data); InflaterInputStream iis = new InflaterInputStream(in); NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag();
ByteArrayInputStream in = new ByteArrayInputStream(data); InflaterInputStream iis = new InflaterInputStream(in); NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag();
public ServerInfo[] loadServers() throws Exception{ final FileInputStream fis = new FileInputStream(file); NBTInputStream nbtIs = new NBTInputStream(fis, false); // the cast should be safe, because compound tag is also a root container of contents in the file... final CompoundTag root = (CompoundTag) nbtIs.readTag(); nbtIs.close(); ListTag serversListTag = (ListTag) root.getValue().get("servers"); if(serversListTag.getElementType() != CompoundTag.class) { throw new Exception("Type of list value in servers file is not tag_compound!"); } List<CompoundTag> serversList = serversListTag.getValue(); ServerInfo[] result = new ServerInfo[serversList.size()]; for(int i = 0; i < serversList.size(); ++i){ result[i] = createServerFromTag(serversList.get(i).getValue()); } return result; }