Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ipeer.minecraft.servers;
- import java.io.DataInputStream;
- import java.io.IOException;
- public class Packet {
- public static String readLine(DataInputStream in, int maxLen) throws IOException {
- StringBuilder stringbuilder = new StringBuilder();
- short word = in.readShort();
- if (word > maxLen)
- throw new IOException("THE STRING IS TOO LONG!");
- if (word < 0)
- throw new IOException("What...? The string has a length < 0!");
- for (int i = 0; i < word; i++)
- {
- stringbuilder.append(in.readChar());
- }
- return stringbuilder.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement