Package org.bladerunnerjs.utility

Examples of org.bladerunnerjs.utility.UnicodeReader


  {
    Writer writer = new StringWriter();
    for(String path: filePaths)
    {
      File sourceFile = new File(filePathBase, path);
      try(Reader reader = new UnicodeReader(sourceFile, defaultFileCharacterEncoding))
      {
        IOUtils.copy(reader, writer);
        writer.write("\n\n");
      }
    }
View Full Code Here


  }
 
  @Override
  public Reader getReader() throws IOException
  {
    return new UnicodeReader(assetFile, defaultFileCharacterEncoding);
  }
View Full Code Here

  public Map<String,String> getLocaleProperties() throws IOException, RequirePathException, NamespaceException
  {
    Map<String, String> propertiesMap = new HashMap<String,String>();
   
    Properties i18nProperties = new Properties();
    i18nProperties.load( new UnicodeReader(assetFile, defaultFileCharacterEncoding) );
   
    for (String property : i18nProperties.stringPropertyNames())
    {
      assetLocation().assertIdentifierCorrectlyNamespaced(property);
      String value = i18nProperties.getProperty(property);
View Full Code Here

    data.aliasDefinitions = new ArrayList<>();
    data.scenarioAliases = new HashMap<>();
    data.groupAliases = new HashMap<>();
   
    if(aliasDefinitionsFile.exists()) {
      try(Reader fileReader = new UnicodeReader(aliasDefinitionsFile, defaultFileCharacterEncoding)) {
        XMLStreamReader2 streamReader = XmlStreamReaderFactory.createReader(fileReader, aliasDefinitionsSchema);
        XmlStreamCursor cursor = new XmlStreamCursor(streamReader);
       
        while(cursor.isWithinInitialNode()) {
          if(streamReader.getEventType() == XMLStreamReader.START_ELEMENT) {
View Full Code Here

    List<Reader> jsFileReaders = new ArrayList<>();

   
    try {     
      for(File file : manifest.getJsFiles()) {
        jsFileReaders.add(new UnicodeReader(file, defaultFileCharacterEncoding));
        jsFileReaders.add(new StringReader("\n\n"));
      }
     
      String defineBlockHeader = String.format(CommonJsSourceModule.COMMONJS_DEFINE_BLOCK_HEADER, getPrimaryRequirePath());
      String defineBlockFooter = CommonJsSourceModule.COMMONJS_DEFINE_BLOCK_FOOTER;
View Full Code Here

  private static final String testFileContents = "test-€";
 
  @Test
  public void testUtf8FileWithoutBOMCanBeReadCorrectly() throws IOException
  {
    UnicodeReader bundlerFileReader = new UnicodeReader(new FileInputStream(new File(resourceDir, "utf8FileWithoutBom.txt")), "UTF-8");
    BufferedReader br = new BufferedReader(bundlerFileReader);
    assertEquals(testFileContents, removeLineEndingSymbols(br.readLine()));
  }
View Full Code Here

  @Override
  public Reader getUnalteredContentReader() throws IOException {
    try
    {
      String defaultFileCharacterEncoding = assetLocation.root().bladerunnerConf().getDefaultFileCharacterEncoding();
      Reader assetReader = new UnicodeReader(assetFile, defaultFileCharacterEncoding);
      if (patch.patchAvailable()){
        return new ConcatReader( new Reader[] { assetReader, patch.getReader() });
      } else {
        return assetReader;
      }
View Full Code Here

  }
 
  @Test
  public void testUtf8FileWithBOMCanBeReadCorrectly() throws IOException
  {
    UnicodeReader bundlerFileReader = new UnicodeReader(new FileInputStream(new File(resourceDir, "utf8FileWithBom.txt")), "UTF-8");
    BufferedReader br = new BufferedReader(bundlerFileReader);
    assertEquals(testFileContents, removeLineEndingSymbols(br.readLine()));
  }
View Full Code Here

  {
    File emptyFile = new File(resourceDir, "emptyFile.txt");
    int buffLength = 8192;
    char[] buff = new char[buffLength];
   
    UnicodeReader bundlerFileReader = new UnicodeReader(new FileInputStream(emptyFile));
    int bytesReadWithBundlerFileReader = bundlerFileReader.read(buff, 0, buffLength);
   
    InputStreamReader isr = new InputStreamReader(new FileInputStream(emptyFile));
    int bytesReadWithInputStreamReader = isr.read(buff, 0, buffLength);
   
    assertEquals(bytesReadWithInputStreamReader, bytesReadWithBundlerFileReader);
View Full Code Here

  {
    File emptyFile = new File(resourceDir, "1byteFile.txt");
    int buffLength = 8192;
    char[] buff = new char[buffLength];
   
    UnicodeReader bundlerFileReader = new UnicodeReader(new FileInputStream(emptyFile));
    int bytesReadWithBundlerFileReader = bundlerFileReader.read(buff, 0, buffLength);
   
    InputStreamReader isr = new InputStreamReader(new FileInputStream(emptyFile));
    int bytesReadWithInputStreamReader = isr.read(buff, 0, buffLength);
   
    assertEquals(bytesReadWithInputStreamReader, bytesReadWithBundlerFileReader);
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.utility.UnicodeReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.