@Override
    public BencodeList parse(BufferedInputStream inputStream) throws IOException, BencodeParseException {
        readAndCheckFirstByte(inputStream);

        List<BencodeType> bencodeTypeList = new ArrayList<BencodeType>();
        int currentByte;
        while ((currentByte = readByteAndMarkPosition(inputStream)) > -1) {
            char currentChar = (char) currentByte;
            if (currentChar == getPostfix()){
                return new BencodeList(bencodeTypeList);
            } else {
                BencodeParser bencodeParser = ParserFactory.getResponsibleParserByFirstChar(currentChar);
                inputStream.reset();
                BencodeType bencodeType =  bencodeParser.parse(inputStream);
                bencodeTypeList.add(bencodeType);
            }
        }
        throw new InvalidFormatException();
    }