如何解码/获取文件编码(Power BI 桌面文件)

how to decode/ get encoding of file (Power BI desktop file)(如何解码/获取文件编码(Power BI 桌面文件))
本文介绍了如何解码/获取文件编码(Power BI 桌面文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试解码 Power BI 桌面报表 (pbix) 内部文件 (DataMashup).我的目标是使用任何编程语言创建 Power-BI 桌面报表、数据模型.我使用 Java 作为初始值.

I am having power BI desktop report(pbix) internal file (DataMashup), which i am trying to decode. My Aim is to create Power-BI desktop report, Data Model using any programming language. I am using Java for initial.

文件使用某种编码技术进行编码.

files are encoded with some encoding technique.

我尝试获取文件的编码,它返回 windows 1254.但没有进行解码.

I tried to get encoding of file and it is returning windows 1254. but decoding is not happening.

File f = new File("example.txt");

    String[] charsetsToBeTested = {"UTF-8", "windows-1254", "ISO-8859-7"};

    CharsetDetector cd = new CharsetDetector();
    Charset charset = cd.detectCharset(f, charsetsToBeTested);

    if (charset != null) {
        try {
            InputStreamReader reader = new InputStreamReader(new FileInputStream(f), charset);
            int c = 0;
            while ((c = reader.read()) != -1) {
                System.out.print((char)c);
            }
            reader.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
        }catch(IOException ioe){
            ioe.printStackTrace();
        }

    }else{
        System.out.println("Unrecognized charset.");
    }

文件解压也不行

public void unZipIt(String zipFile, String outputFolder)
{
    byte buffer[] = new byte[1024];
    try
    {
        File folder = new File(outputFolder);
        if(!folder.exists())
        {
            folder.mkdir();
        }
        ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));
        System.out.println(zis);

        System.out.println(zis.getNextEntry());
        for(ZipEntry ze = zis.getNextEntry(); ze != null; ze = zis.getNextEntry())
        {
            String fileName = ze.getName();
            System.out.println(ze);
            File newFile = new File((new StringBuilder(String.valueOf(outputFolder))).append(File.separator).append(fileName).toString());
            System.out.println((new StringBuilder("file unzip : ")).append(newFile.getAbsoluteFile()).toString());
            (new File(newFile.getParent())).mkdirs();
            FileOutputStream fos = new FileOutputStream(newFile);
            int len;
            while((len = zis.read(buffer)) > 0) 
            {
                fos.write(buffer, 0, len);
            }
            fos.close();
        }

        zis.closeEntry();
        zis.close();
        System.out.println("Done");
    }
    catch(IOException ex)
    {
        ex.printStackTrace();
    }
}

推荐答案

您可以使用 System.IO.Packaging 库来提取 Power BI 数据混搭.它使用 OPC 封装标准,请参阅 这里.

You can use the System.IO.Packaging library to extract the Power BI data mashup. It uses the OPC package standard, see here.

这篇关于如何解码/获取文件编码(Power BI 桌面文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
Correct way to sign and verify signature using bouncycastle(使用 bouncycastle 签名和验证签名的正确方法)
Creating RSA Public Key From String(从字符串创建 RSA 公钥)
Why java.security.NoSuchProviderException No such provider: BC?(为什么 java.security.NoSuchProviderException 没有这样的提供者:BC?)
Generating X509 Certificate using Bouncy Castle Java(使用 Bouncy Castle Java 生成 X509 证书)
How can I get a PublicKey object from EC public key bytes?(如何从 EC 公钥字节中获取 PublicKey 对象?)