Java Code Examples for org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder#decode()

The following examples show how to use org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder#decode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NBTChecker_v1_11_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	//HashMap<String, String> ke = new HashMap<String, String>();
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		 //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 2
Source File: NBTChecker_v1_12_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (IOException ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 3
Source File: NBTChecker_v1_8_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	  String b = tag.get(key).toString();
       	  
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		//  System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 4
Source File: NBTChecker_v1_8_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 5
Source File: NBTChecker_v1_13_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
    //HashMap<String, String> ke = new HashMap<String, String>();
    ArrayList<String> t = new ArrayList<String>();
    byte[] testBytes = Base64Coder.decode(s);
    ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
    try
    {
        NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
        Set<String> keys = tag.getKeys();
        for (String key : keys) {
            // System.out.println(key);
            String b = tag.get(key).toString();
            //System.out.println(b);
            String[] arr = b.split(",");
            for(int c = 0; c < arr.length; c++){

                //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
                if(arr[c].contains("minecraft:")){
                    return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
                }

            }
        }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
    return t.toString();
}
 
Example 6
Source File: NBTChecker_v1_13_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
    ArrayList<String> t = new ArrayList<String>();
    byte[] testBytes = Base64Coder.decode(s);
    ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
    try
    {
        NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
        Set<String> keys = tag.getKeys();
        for (String key : keys) {
            // System.out.println(key);
            String b = tag.get(key).toString();
            //System.out.println(b);
            String[] arr = b.split(",");
            ArrayList<String> list = new ArrayList<String>();
            for(int c = 0; c < arr.length; c++){
                //System.out.println(arr[c]);
                if(arr[c].toLowerCase().contains("uuid")){

                }else{
                    list.add(arr[c]);
                }
            }

            b =  new StringBuilder().append(list).toString();
            t.add(key + ":" + b);
        }
    }
    catch (IOException ex)
    {
        ex.printStackTrace();
    }
    return t;
}
 
Example 7
Source File: NBTChecker_v1_9_R2.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	//HashMap<String, String> ke = new HashMap<String, String>();
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		 //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 8
Source File: NBTChecker_v1_9_R2.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (IOException ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 9
Source File: NBTChecker_v1_9_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	//HashMap<String, String> ke = new HashMap<String, String>();
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		 //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 10
Source File: NBTChecker_v1_12_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	//HashMap<String, String> ke = new HashMap<String, String>();
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		 //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 11
Source File: NBTChecker_v1_11_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (IOException ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 12
Source File: NBTChecker_v1_10_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (IOException ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 13
Source File: NBTChecker_v1_8_R2.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<String> getTags(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  ArrayList<String> list = new ArrayList<String>();
       	  for(int c = 0; c < arr.length; c++){
       		  //System.out.println(arr[c]);
       		  if(arr[c].toLowerCase().contains("uuid")){
       			
       		  }else{
       			  list.add(arr[c]);
       		  }
       	  }
       	  
       	  b =  new StringBuilder().append(list).toString();
       	t.add(key + ":" + b);
         }
       }
       catch (IOException ex)
       {
       	ex.printStackTrace();
       }
	return t;
}
 
Example 14
Source File: Base64CoderTest.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
private void check(String text, String encoded) throws UnsupportedEncodingException {
    char[] s1 = Base64Coder.encode(text.getBytes("UTF-8"));
    String t1 = new String(s1);
    assertEquals(encoded, t1);
    byte[] s2 = Base64Coder.decode(encoded.toCharArray());
    String t2 = new String(s2, "UTF-8");
    assertEquals(text, t2);
}
 
Example 15
Source File: NBTChecker_v1_7_R4.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	  String b = tag.get(key).toString();
       	  
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		//  System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 16
Source File: NBTChecker_v1_10_R1.java    From ProRecipes with GNU General Public License v2.0 5 votes vote down vote up
public String getPotionType(String s) {
	//HashMap<String, String> ke = new HashMap<String, String>();
	ArrayList<String> t = new ArrayList<String>();
	byte[] testBytes = Base64Coder.decode(s);
	ByteArrayInputStream buf = new ByteArrayInputStream(testBytes);
   	 try
       {
         NBTTagCompound tag = NBTCompressedStreamTools.a(buf);
         Set<String> keys = tag.c();
         for (String key : keys) {
       	 // System.out.println(key);
       	  String b = tag.get(key).toString();
       	  //System.out.println(b);
       	  String[] arr = b.split(",");
       	  for(int c = 0; c < arr.length; c++){
       		 
       		 //System.out.println("SOMETHING IN A LOOP ?   "  + arr[c]);
       		  if(arr[c].contains("minecraft:")){
       			  return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", "");
       		  }
       		  
       	  }
         }
       }
       catch (Exception ex)
       {
       	ex.printStackTrace();
       }
	return t.toString();
}
 
Example 17
Source File: YamlBase64Test.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
/**
 * test base64 decoding
 */
public void testBase64() throws IOException {
    String text = Util.getLocalResource("issues/issue99-base64_literal.yaml");
    String[] lines = text.split("\n");
    String all = "";
    for (int i = 1; i < lines.length; i++) {// skip first line
        all = all + lines[i].trim();
    }
    // System.out.println(all);
    byte[] decoded = Base64Coder.decode(all.toCharArray());
    assertEquals(3737, decoded.length);
    checkBytes(decoded);
}
 
Example 18
Source File: SafeConstructor.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
public Object construct(Node node) {
    byte[] decoded = Base64Coder.decode(constructScalar((ScalarNode) node).toString()
            .toCharArray());
    return decoded;
}
 
Example 19
Source File: YamlBase64Test.java    From snake-yaml with Apache License 2.0 4 votes vote down vote up
public Object construct(Node node) {
    String contentWithNewLines = constructScalar((ScalarNode) node).toString();
    String noNewLines = contentWithNewLines.replaceAll("\\s", "");
    byte[] decoded = Base64Coder.decode(noNewLines.toCharArray());
    return decoded;
}
 
Example 20
Source File: SafeConstructor.java    From snake-yaml with Apache License 2.0 4 votes vote down vote up
public Object construct(Node node) {
    byte[] decoded = Base64Coder.decode(constructScalar((ScalarNode) node).toString()
            .toCharArray());
    return decoded;
}